From 6f1f5b67e044b151feec164e4fad13ce282417c1 Mon Sep 17 00:00:00 2001 From: Pedro <3602279+Doc94@users.noreply.github.com> Date: Fri, 2 May 2025 17:19:15 -0400 Subject: [PATCH] Fix ArmorStand items for canceled EntityDeathEvent (#12288) Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> --- .../entity/decoration/ArmorStand.java.patch | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/paper-server/patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch index 4e881f2b48..02c0dba9e6 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/decoration/ArmorStand.java.patch @@ -198,7 +198,7 @@ } return true; -@@ -400,31 +_,34 @@ +@@ -400,31 +_,42 @@ float health = this.getHealth(); health -= damageAmount; if (health <= 0.5F) { @@ -231,13 +231,24 @@ + // this.dropAllDeathLoot(level, damageSource); // CraftBukkit - moved down for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { - ItemStack itemStack = this.equipment.set(equipmentSlot, ItemStack.EMPTY); +- ItemStack itemStack = this.equipment.set(equipmentSlot, ItemStack.EMPTY); ++ ItemStack itemStack = this.equipment.get(equipmentSlot); // Paper - move equipment removal past event call if (!itemStack.isEmpty()) { - Block.popResource(this.level(), this.blockPosition().above(), itemStack); +- } +- } + this.drops.add(new DefaultDrop(itemStack, stack -> Block.popResource(this.level(), this.blockPosition().above(), stack))); // CraftBukkit - add to drops // Paper - Restore vanilla drops behavior; mirror so we can destroy it later - though this call site was safe & spawn drops correctly} - } - } -+ return this.dropAllDeathLoot(level, damageSource); // CraftBukkit - moved from above // Paper ++ } ++ } ++ // Paper start - move equipment removal past event call ++ org.bukkit.event.entity.EntityDeathEvent event = this.dropAllDeathLoot(level, damageSource); ++ if (!event.isCancelled()) { ++ for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) { ++ this.equipment.set(equipmentSlot, ItemStack.EMPTY); ++ } ++ } ++ return event; ++ // Paper end - move equipment removal past event call } private void playBrokenSound() {