SPIGOT-7490: Fix entity equipment updates

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2023-09-25 07:47:22 +10:00
parent 5692b3f59a
commit 70eb4fdda5
2 changed files with 23 additions and 5 deletions

View file

@ -117,7 +117,7 @@
if (!list.isEmpty()) {
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
}
+ ((EntityLiving) this.entity).detectEquipmentUpdates(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
+ ((EntityLiving) this.entity).detectEquipmentUpdatesPublic(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
+ }
+
+ // CraftBukkit start - MC-109346: Fix for nonsensical head yaw

View file

@ -536,7 +536,7 @@
+ return i;
+ } else {
+ return 0;
+ }
}
+ }
+ // CraftBukkit end
+
@ -545,7 +545,7 @@
+ if (true && !(this instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time
+ EntityExperienceOrb.award((WorldServer) this.level(), this.position(), this.expToDrop);
+ this.expToDrop = 0;
}
+ }
+ // CraftBukkit end
}
@ -726,7 +726,7 @@
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
+ this.hurtArmor(damagesource, armorDamage);
+ }
+
+ // Apply blocking code // PAIL: steal from above
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
+ this.level().broadcastEntityEvent(this, (byte) 29); // SPIGOT-4635 - shield damage sound
@ -741,7 +741,7 @@
+ absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION);
+ this.setAbsorptionAmount(Math.max(this.getAbsorptionAmount() - absorptionModifier, 0.0F));
+ float f2 = absorptionModifier;
+
+ if (f2 > 0.0F && f2 < 3.4028235E37F && this instanceof EntityHuman) {
+ ((EntityHuman) this).awardStat(StatisticList.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
+ }
@ -839,6 +839,24 @@
this.setSharedFlag(7, false);
}
} else {
@@ -2443,7 +2891,7 @@
}
}
- this.detectEquipmentUpdates();
+ this.detectEquipmentUpdatesPublic(); // CraftBukkit
if (this.tickCount % 20 == 0) {
this.getCombatTracker().recheckStatus();
}
@@ -2540,7 +2988,7 @@
this.refreshDirtyAttributes();
}
- public void detectEquipmentUpdates() {
+ public void detectEquipmentUpdatesPublic() { // CraftBukkit
Map<EnumItemSlot, ItemStack> map = this.collectEquipmentChanges();
if (map != null) {
@@ -2837,6 +3285,7 @@
}