Skip to content

Commit

Permalink
Don't fire the drop event on player deaths (#10046)
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker authored Dec 19, 2023
1 parent 0b95298 commit 47b2c18
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions patches/server/1045-Restore-vanilla-entity-drops-behavior.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on dropping the item instead of generalizing it for all dropped
items like CB does.

diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5fe743567f2e9cf0f9442ddd87453c51af8060e6..8efbbd379244e3ed54d4aba199037cc20ccd096a 100644
index 5fe743567f2e9cf0f9442ddd87453c51af8060e6..d1f20a8a3ccea1f074624163eb96da023142a459 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -944,22 +944,20 @@ public class ServerPlayer extends Player {
Expand All @@ -24,7 +24,7 @@ index 5fe743567f2e9cf0f9442ddd87453c51af8060e6..8efbbd379244e3ed54d4aba199037cc2
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)
}
}
}
Expand All @@ -38,6 +38,17 @@ index 5fe743567f2e9cf0f9442ddd87453c51af8060e6..8efbbd379244e3ed54d4aba199037cc2
this.drops.clear(); // SPIGOT-5188: make sure to clear
} // Paper

@@ -2441,8 +2439,8 @@ 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 1f2e74969f9d459cf3bc123c96309fc0a6165ea0..0c46a4aeafd03fbbfd590b0362d41bf2b1d5ca74 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
Expand Down

0 comments on commit 47b2c18

Please sign in to comment.