PaperMC/paper-server/patches/sources/net/minecraft/world/item/ItemUtils.java.patch

20 lines
1.1 KiB
Diff
Raw Normal View History

--- a/net/minecraft/world/item/ItemUtils.java
+++ b/net/minecraft/world/item/ItemUtils.java
2024-12-14 21:50:20 +01:00
@@ -41,7 +_,15 @@
public static void onContainerDestroyed(ItemEntity container, Iterable<ItemStack> contents) {
Level level = container.level();
if (!level.isClientSide) {
2024-12-14 21:50:20 +01:00
- contents.forEach(itemStack -> level.addFreshEntity(new ItemEntity(level, container.getX(), container.getY(), container.getZ(), itemStack)));
+ // Paper start - call EntityDropItemEvent
2024-12-15 23:07:15 +01:00
+ contents.forEach(itemStack -> {
+ ItemEntity droppedItem = new ItemEntity(level, container.getX(), container.getY(), container.getZ(), itemStack);
2024-12-14 21:50:20 +01:00
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(container.getBukkitEntity(), (org.bukkit.entity.Item) droppedItem.getBukkitEntity());
+ if (event.callEvent()) {
+ level.addFreshEntity(droppedItem);
+ }
+ });
+ // Paper end - call EntityDropItemEvent
}
}
}