mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
19 lines
1.1 KiB
Diff
19 lines
1.1 KiB
Diff
--- a/net/minecraft/world/item/ItemUtils.java
|
|
+++ b/net/minecraft/world/item/ItemUtils.java
|
|
@@ -41,7 +_,15 @@
|
|
public static void onContainerDestroyed(ItemEntity container, Iterable<ItemStack> contents) {
|
|
Level level = container.level();
|
|
if (!level.isClientSide) {
|
|
- contents.forEach(itemStack -> level.addFreshEntity(new ItemEntity(level, container.getX(), container.getY(), container.getZ(), itemStack)));
|
|
+ // Paper start - call EntityDropItemEvent
|
|
+ contents.forEach(itemStack -> {
|
|
+ ItemEntity droppedItem = new ItemEntity(level, container.getX(), container.getY(), container.getZ(), itemStack);
|
|
+ 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
|
|
}
|
|
}
|
|
}
|