mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-17 13:24:17 -07:00
Don't fire the drop event on player deaths (#10046)
This commit is contained in:
@@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
for (ItemStack item : this.getInventory().getContents()) {
|
for (ItemStack item : this.getInventory().getContents()) {
|
||||||
if (!item.isEmpty() && !EnchantmentHelper.hasVanishingCurse(item)) {
|
if (!item.isEmpty() && !EnchantmentHelper.hasVanishingCurse(item)) {
|
||||||
- loot.add(CraftItemStack.asCraftMirror(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
|
this.drops.clear(); // SPIGOT-5188: make sure to clear
|
||||||
} // Paper
|
} // 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
|
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
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
Reference in New Issue
Block a user