Skip to content

Commit

Permalink
SPIGOT-7490: Fix entity equipment updates
Browse files Browse the repository at this point in the history
  • Loading branch information
md-5 committed Sep 24, 2023
1 parent f0661c3 commit e62905a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 22 additions & 4 deletions nms-patches/net/minecraft/world/entity/EntityLiving.patch
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@
+ return i;
+ } else {
+ return 0;
+ }
}
+ }
+ // CraftBukkit end
+
Expand All @@ -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

}
Expand Down Expand Up @@ -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
Expand All @@ -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));
+ }
Expand Down Expand Up @@ -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 @@
}

Expand Down

0 comments on commit e62905a

Please sign in to comment.