diff --git a/build-data/paper.at b/build-data/paper.at index ee280f0d19..eff98f86f1 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -72,8 +72,6 @@ public net.minecraft.server.level.ChunkMap getPoiManager()Lnet/minecraft/world/e # Improve death events public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sounds/SoundEvent; public net.minecraft.world.entity.LivingEntity getSoundVolume()F -public net.minecraft.world.entity.Mob handItems -public net.minecraft.world.entity.Mob armorItems # Add sun related api public net.minecraft.world.entity.Mob isSunBurnTick()Z diff --git a/patches/server/Fix-numerous-item-duplication-issues-and-teleport-is.patch b/patches/server/Fix-numerous-item-duplication-issues-and-teleport-is.patch index ad8b0e6d92..c28f65688c 100644 --- a/patches/server/Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/patches/server/Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -94,11 +94,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // entityliving.awardKillScore(this, this.deathScore, source); + // } // Paper start - clear equipment if event is not cancelled - if (this instanceof Mob mob) { - java.util.Collections.fill(mob.handItems, ItemStack.EMPTY); + if (this instanceof Mob) { + for (EquipmentSlot slot : this.clearedEquipmentSlots) { @@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity { this.dropCustomDeathLoot(source, i, flag); - this.clearEquipmentSlots = true; // Paper + this.clearEquipmentSlots = prev; // Paper } - // CraftBukkit start - Call death event - org.bukkit.event.entity.EntityDeathEvent deathEvent = CraftEventFactory.callEntityDeathEvent(this, this.drops); // Paper diff --git a/patches/server/Improve-death-events.patch b/patches/server/Improve-death-events.patch index a2f38bbfb2..9cbcb772af 100644 --- a/patches/server/Improve-death-events.patch +++ b/patches/server/Improve-death-events.patch @@ -131,9 +131,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + entityliving.awardKillScore(this, this.deathScore, source); + } + // Paper start - clear equipment if event is not cancelled -+ if (this instanceof Mob mob) { -+ java.util.Collections.fill(mob.handItems, ItemStack.EMPTY); -+ java.util.Collections.fill(mob.armorItems, ItemStack.EMPTY); ++ if (this instanceof Mob) { ++ for (EquipmentSlot slot : this.clearedEquipmentSlots) { ++ this.setItemSlot(slot, ItemStack.EMPTY); ++ } ++ this.clearedEquipmentSlots.clear(); + } + // Paper end + @@ -178,8 +180,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - protected void dropAllDeathLoot(DamageSource source) { -+ protected boolean clearEquipmentSlots = true; // Paper -+ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(DamageSource source) { // Paper ++ // Paper start ++ protected boolean clearEquipmentSlots = true; ++ protected Set clearedEquipmentSlots = new java.util.HashSet<>(); ++ protected org.bukkit.event.entity.EntityDeathEvent dropAllDeathLoot(DamageSource source) { ++ // Paper end Entity entity = source.getEntity(); int i; @@ -187,9 +192,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.dropEquipment(); // CraftBukkit - from below if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { this.dropFromLootTable(source, flag); -+ this.clearEquipmentSlots = false; // Paper ++ // Paper start ++ final boolean prev = this.clearEquipmentSlots; ++ this.clearEquipmentSlots = false; ++ this.clearedEquipmentSlots.clear(); ++ // Paper end this.dropCustomDeathLoot(source, i, flag); -+ this.clearEquipmentSlots = true; // Paper ++ this.clearEquipmentSlots = prev; // Paper } // CraftBukkit start - Call death event - CraftEventFactory.callEntityDeathEvent(this, this.drops); @@ -218,7 +227,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.spawnAtLocation(itemstack); + if (this.clearEquipmentSlots) { // Paper this.setItemSlot(enumitemslot, ItemStack.EMPTY); -+ } // Paper ++ // Paper start ++ } else { ++ this.clearedEquipmentSlots.add(enumitemslot); ++ } ++ // Paper end } }