1.21.6 dev
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
committed by
Nassim Jahnke
parent
39203a65e0
commit
a24f9b204c
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -49,6 +_,70 @@
|
||||
@@ -56,6 +_,80 @@
|
||||
public final Player player;
|
||||
public final EntityEquipment equipment;
|
||||
private int timesChanged;
|
||||
@@ -24,9 +24,19 @@
|
||||
+ }
|
||||
+
|
||||
+ public java.util.List<ItemStack> getArmorContents() {
|
||||
+ java.util.List<ItemStack> items = new java.util.ArrayList<>(4);
|
||||
+ for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOTS_SORTED_BY_INDEX) {
|
||||
+ if (equipmentSlot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {
|
||||
+ items.add(this.equipment.get(equipmentSlot));
|
||||
+ }
|
||||
+ }
|
||||
+ return items;
|
||||
+ }
|
||||
+
|
||||
+ public java.util.List<ItemStack> getExtraContent() {
|
||||
+ java.util.List<ItemStack> items = new java.util.ArrayList<>();
|
||||
+ for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOTS_SORTED_BY_INDEX) {
|
||||
+ if (equipmentSlot.isArmor()) {
|
||||
+ if (equipmentSlot.getType() != EquipmentSlot.Type.HUMANOID_ARMOR) { // Non humanoid armor is considered extra
|
||||
+ items.add(this.equipment.get(equipmentSlot));
|
||||
+ }
|
||||
+ }
|
||||
@@ -71,7 +81,7 @@
|
||||
|
||||
public Inventory(Player player, EntityEquipment equipment) {
|
||||
this.player = player;
|
||||
@@ -85,10 +_,39 @@
|
||||
@@ -92,10 +_,39 @@
|
||||
|
||||
private boolean hasRemainingSpaceForItem(ItemStack destination, ItemStack origin) {
|
||||
return !destination.isEmpty()
|
||||
@@ -114,7 +124,7 @@
|
||||
|
||||
public int getFreeSlot() {
|
||||
for (int i = 0; i < this.items.size(); i++) {
|
||||
@@ -100,8 +_,10 @@
|
||||
@@ -107,8 +_,10 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -127,7 +137,7 @@
|
||||
if (!this.items.get(this.selected).isEmpty()) {
|
||||
int freeSlot = this.getFreeSlot();
|
||||
if (freeSlot != -1) {
|
||||
@@ -112,8 +_,10 @@
|
||||
@@ -119,8 +_,10 @@
|
||||
this.items.set(this.selected, stack);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/net/minecraft/world/entity/player/Player.java
|
||||
@@ -169,7 +_,7 @@
|
||||
@@ -178,7 +_,7 @@
|
||||
private static final int DEFAULT_CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME = 0;
|
||||
private long timeEntitySatOnShoulder;
|
||||
final Inventory inventory;
|
||||
@@ -9,7 +9,7 @@
|
||||
public final InventoryMenu inventoryMenu;
|
||||
public AbstractContainerMenu containerMenu;
|
||||
protected FoodData foodData = new FoodData();
|
||||
@@ -208,6 +_,18 @@
|
||||
@@ -217,6 +_,18 @@
|
||||
public Entity currentExplosionCause;
|
||||
private boolean ignoreFallDamageFromCurrentImpulse = false;
|
||||
private int currentImpulseContextResetGraceTime = 0;
|
||||
@@ -26,9 +26,9 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
public Player(Level level, BlockPos pos, float yRot, GameProfile gameProfile) {
|
||||
public Player(Level level, GameProfile gameProfile) {
|
||||
super(EntityType.PLAYER, level);
|
||||
@@ -276,6 +_,13 @@
|
||||
@@ -286,6 +_,13 @@
|
||||
|
||||
if (this.isSleeping()) {
|
||||
this.sleepCounter++;
|
||||
@@ -42,7 +42,7 @@
|
||||
if (this.sleepCounter > 100) {
|
||||
this.sleepCounter = 100;
|
||||
}
|
||||
@@ -293,7 +_,7 @@
|
||||
@@ -303,7 +_,7 @@
|
||||
this.updateIsUnderwater();
|
||||
super.tick();
|
||||
if (!this.level().isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) {
|
||||
@@ -51,7 +51,7 @@
|
||||
this.containerMenu = this.inventoryMenu;
|
||||
}
|
||||
|
||||
@@ -380,7 +_,7 @@
|
||||
@@ -390,7 +_,7 @@
|
||||
}
|
||||
|
||||
private void turtleHelmetTick() {
|
||||
@@ -60,7 +60,7 @@
|
||||
}
|
||||
|
||||
private boolean isEquipped(Item item) {
|
||||
@@ -527,6 +_,18 @@
|
||||
@@ -537,6 +_,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
public void closeContainer() {
|
||||
this.containerMenu = this.inventoryMenu;
|
||||
}
|
||||
@@ -538,8 +_,14 @@
|
||||
@@ -548,8 +_,14 @@
|
||||
public void rideTick() {
|
||||
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
|
||||
this.stopRiding();
|
||||
@@ -96,7 +96,7 @@
|
||||
super.rideTick();
|
||||
this.oBob = this.bob;
|
||||
this.bob = 0.0F;
|
||||
@@ -598,6 +_,7 @@
|
||||
@@ -608,6 +_,7 @@
|
||||
this.playShoulderEntityAmbientSound(this.getShoulderEntityLeft());
|
||||
this.playShoulderEntityAmbientSound(this.getShoulderEntityRight());
|
||||
if (!this.level().isClientSide && (this.fallDistance > 0.5 || this.isInWater()) || this.abilities.flying || this.isSleeping() || this.isInPowderSnow) {
|
||||
@@ -104,7 +104,7 @@
|
||||
this.removeEntitiesOnShoulder();
|
||||
}
|
||||
}
|
||||
@@ -841,10 +_,10 @@
|
||||
@@ -850,10 +_,10 @@
|
||||
if (this.isDeadOrDying()) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -117,7 +117,7 @@
|
||||
}
|
||||
|
||||
if (level.getDifficulty() == Difficulty.EASY) {
|
||||
@@ -856,7 +_,14 @@
|
||||
@@ -865,7 +_,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -868,7 +_,7 @@
|
||||
@@ -877,7 +_,7 @@
|
||||
BlocksAttacks blocksAttacks = itemBlockingWith != null ? itemBlockingWith.get(DataComponents.BLOCKS_ATTACKS) : null;
|
||||
float secondsToDisableBlocking = entity.getSecondsToDisableBlocking();
|
||||
if (secondsToDisableBlocking > 0.0F && blocksAttacks != null) {
|
||||
@@ -142,7 +142,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -878,9 +_,29 @@
|
||||
@@ -887,9 +_,29 @@
|
||||
}
|
||||
|
||||
public boolean canHarmPlayer(Player other) {
|
||||
@@ -175,7 +175,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -894,7 +_,12 @@
|
||||
@@ -903,7 +_,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,7 +189,7 @@
|
||||
if (!this.isInvulnerableTo(level, damageSource)) {
|
||||
amount = this.getDamageAfterArmorAbsorb(damageSource, amount);
|
||||
amount = this.getDamageAfterMagicAbsorb(damageSource, amount);
|
||||
@@ -906,7 +_,7 @@
|
||||
@@ -915,7 +_,7 @@
|
||||
}
|
||||
|
||||
if (var8 != 0.0F) {
|
||||
@@ -198,7 +198,7 @@
|
||||
this.getCombatTracker().recordDamage(damageSource, var8);
|
||||
this.setHealth(this.getHealth() - var8);
|
||||
if (var8 < 3.4028235E37F) {
|
||||
@@ -916,6 +_,7 @@
|
||||
@@ -925,6 +_,7 @@
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGE);
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@
|
||||
}
|
||||
|
||||
public boolean isTextFilteringEnabled() {
|
||||
@@ -997,13 +_,19 @@
|
||||
@@ -1009,13 +_,19 @@
|
||||
|
||||
@Override
|
||||
public void removeVehicle() {
|
||||
@@ -228,7 +228,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1082,8 +_,17 @@
|
||||
@@ -1094,8 +_,17 @@
|
||||
}
|
||||
|
||||
public void attack(Entity target) {
|
||||
@@ -248,7 +248,7 @@
|
||||
float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float)this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
||||
ItemStack weaponItem = this.getWeaponItem();
|
||||
DamageSource damageSource = Optional.ofNullable(weaponItem.getItem().getDamageSource(this)).orElse(this.damageSources().playerAttack(this));
|
||||
@@ -1091,18 +_,25 @@
|
||||
@@ -1103,18 +_,25 @@
|
||||
float attackStrengthScale = this.getAttackStrengthScale(0.5F);
|
||||
f *= 0.2F + attackStrengthScale * attackStrengthScale * 0.8F;
|
||||
f1 *= attackStrengthScale;
|
||||
@@ -281,7 +281,7 @@
|
||||
flag1 = true;
|
||||
} else {
|
||||
flag1 = false;
|
||||
@@ -1118,7 +_,9 @@
|
||||
@@ -1130,7 +_,9 @@
|
||||
&& !this.isPassenger()
|
||||
&& target instanceof LivingEntity
|
||||
&& !this.isSprinting();
|
||||
@@ -291,7 +291,7 @@
|
||||
f *= 1.5F;
|
||||
}
|
||||
|
||||
@@ -1145,17 +_,23 @@
|
||||
@@ -1157,17 +_,23 @@
|
||||
if (target instanceof LivingEntity livingEntity1) {
|
||||
livingEntity1.knockback(
|
||||
f4 * 0.5F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0))
|
||||
@@ -315,7 +315,7 @@
|
||||
}
|
||||
|
||||
if (flag3) {
|
||||
@@ -1169,42 +_,59 @@
|
||||
@@ -1181,42 +_,59 @@
|
||||
&& !(livingEntity2 instanceof ArmorStand armorStand && armorStand.isMarker())
|
||||
&& this.distanceToSqr(livingEntity2) < 9.0) {
|
||||
float f6 = this.getEnchantedDamage(livingEntity2, f5, damageSource) * attackStrengthScale;
|
||||
@@ -386,7 +386,7 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1252,10 +_,11 @@
|
||||
@@ -1264,10 +_,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1290,8 +_,8 @@
|
||||
@@ -1302,8 +_,8 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -412,7 +412,7 @@
|
||||
this.inventoryMenu.removed(this);
|
||||
if (this.containerMenu != null && this.hasContainerOpen()) {
|
||||
this.doCloseContainer();
|
||||
@@ -1355,6 +_,12 @@
|
||||
@@ -1367,6 +_,12 @@
|
||||
}
|
||||
|
||||
public Either<Player.BedSleepingProblem, Unit> startSleepInBed(BlockPos bedPos) {
|
||||
@@ -425,7 +425,7 @@
|
||||
this.startSleeping(bedPos);
|
||||
this.sleepCounter = 0;
|
||||
return Either.right(Unit.INSTANCE);
|
||||
@@ -1466,7 +_,7 @@
|
||||
@@ -1478,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) {
|
||||
@@ -434,7 +434,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (fallDistance >= 2.0) {
|
||||
@@ -1507,7 +_,15 @@
|
||||
@@ -1519,7 +_,15 @@
|
||||
}
|
||||
|
||||
public void startFallFlying() {
|
||||
@@ -451,7 +451,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1613,15 +_,35 @@
|
||||
@@ -1625,15 +_,35 @@
|
||||
public int getXpNeededForNextLevel() {
|
||||
if (this.experienceLevel >= 30) {
|
||||
return 112 + (this.experienceLevel - 30) * 9;
|
||||
@@ -489,7 +489,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1715,24 +_,53 @@
|
||||
@@ -1727,31 +_,60 @@
|
||||
|
||||
public void removeEntitiesOnShoulder() {
|
||||
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
|
||||
@@ -532,24 +532,32 @@
|
||||
+ @Nullable
|
||||
+ private Entity respawnEntityOnShoulder0(CompoundTag entityCompound) { // CraftBukkit void->boolean
|
||||
+ // Paper end - release entity api - return entity - overload
|
||||
if (!this.level().isClientSide && !entityCompound.isEmpty()) {
|
||||
- EntityType.create(entityCompound, this.level(), EntitySpawnReason.LOAD).ifPresent(entity -> {
|
||||
+ return EntityType.create(entityCompound, this.level(), EntitySpawnReason.LOAD).map((entity) -> { // CraftBukkit
|
||||
if (entity instanceof TamableAnimal tamableAnimal) {
|
||||
tamableAnimal.setOwner(this);
|
||||
}
|
||||
if (this.level() instanceof ServerLevel serverLevel && !entityCompound.isEmpty()) {
|
||||
try (ProblemReporter.ScopedCollector scopedCollector = new ProblemReporter.ScopedCollector(this.problemPath(), LOGGER)) {
|
||||
- EntityType.create(
|
||||
+ return EntityType.create( // Paper - release entity api
|
||||
TagValueInput.create(scopedCollector.forChild(() -> ".shoulder"), serverLevel.registryAccess(), entityCompound),
|
||||
serverLevel,
|
||||
EntitySpawnReason.LOAD
|
||||
)
|
||||
- .ifPresent(entity -> {
|
||||
+ .map(entity -> { // Paper - release entity api
|
||||
if (entity instanceof TamableAnimal tamableAnimal) {
|
||||
tamableAnimal.setOwner(this);
|
||||
}
|
||||
|
||||
entity.setPos(this.getX(), this.getY() + 0.7F, this.getZ());
|
||||
- ((ServerLevel)this.level()).addWithUUID(entity);
|
||||
- });
|
||||
+ return ((ServerLevel)this.level()).addWithUUID(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY) ? entity : null; // CraftBukkit // Paper start - release entity api - return entity
|
||||
+ }).orElse(null); // CraftBukkit // Paper end - release entity api - return entity
|
||||
entity.setPos(this.getX(), this.getY() + 0.7F, this.getZ());
|
||||
- serverLevel.addWithUUID(entity);
|
||||
- });
|
||||
+ return serverLevel.addWithUUID(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHOULDER_ENTITY) ? entity : null; // Paper - spawn reason
|
||||
+ }).orElse(null); // Paper - release entity api - return entity
|
||||
}
|
||||
}
|
||||
+ return null; // Paper - return null
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1926,17 +_,32 @@
|
||||
@@ -1945,17 +_,32 @@
|
||||
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
|
||||
}
|
||||
|
||||
@@ -584,7 +592,7 @@
|
||||
|
||||
for (int i = 0; i < this.inventory.getContainerSize(); i++) {
|
||||
ItemStack item = this.inventory.getItem(i);
|
||||
@@ -1945,6 +_,7 @@
|
||||
@@ -1964,6 +_,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,7 +600,7 @@
|
||||
return this.hasInfiniteMaterials() ? new ItemStack(Items.ARROW) : ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
@@ -2027,12 +_,20 @@
|
||||
@@ -2046,12 +_,20 @@
|
||||
}
|
||||
|
||||
public boolean hasClientLoaded() {
|
||||
|
||||
Reference in New Issue
Block a user