From 516942a4d50bbe7532813492f1d9765e073fd3de Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 18 Dec 2023 20:57:49 -0800 Subject: [PATCH] Don't fire the drop event on player deaths (#10046) --- .../Restore-vanilla-entity-drops-behavior.patch | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/patches/server/Restore-vanilla-entity-drops-behavior.patch b/patches/server/Restore-vanilla-entity-drops-behavior.patch index f46317e957..302e450dda 100644 --- a/patches/server/Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/Restore-vanilla-entity-drops-behavior.patch @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (ItemStack item : this.getInventory().getContents()) { if (!item.isEmpty() && !EnchantmentHelper.hasVanishingCurse(item)) { - loot.add(CraftItemStack.asCraftMirror(item)); -+ loot.add(new DefaultDrop(item, stack -> this.drop(stack, true, false))); // Paper - drop function taken from Inventory#dropAll ++ loot.add(new DefaultDrop(item, stack -> this.drop(stack, true, false, false))); // Paper - drop function taken from Inventory#dropAll (don't fire drop event) } } } @@ -38,6 +38,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.drops.clear(); // SPIGOT-5188: make sure to clear } // Paper +@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { + } + + @Override +- public ItemEntity drop(ItemStack stack, boolean throwRandomly, boolean retainOwnership) { +- ItemEntity entityitem = super.drop(stack, throwRandomly, retainOwnership); ++ public ItemEntity drop(ItemStack stack, boolean throwRandomly, boolean retainOwnership, boolean callDropEvent) { // Paper - override method with most params ++ ItemEntity entityitem = super.drop(stack, throwRandomly, retainOwnership, callDropEvent); // Paper - override method with most params + + if (entityitem == null) { + return null; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java