mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-07 19:12:22 +01:00
20 lines
1.1 KiB
Diff
20 lines
1.1 KiB
Diff
|
--- a/net/minecraft/world/item/ItemUtils.java
|
||
|
+++ b/net/minecraft/world/item/ItemUtils.java
|
||
|
@@ -41,7 +41,15 @@
|
||
|
public static void onContainerDestroyed(ItemEntity itemEntity, Iterable<ItemStack> contents) {
|
||
|
Level level = itemEntity.level();
|
||
|
if (!level.isClientSide) {
|
||
|
- contents.forEach(stack -> level.addFreshEntity(new ItemEntity(level, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), stack)));
|
||
|
+ // Paper start - call EntityDropItemEvent
|
||
|
+ contents.forEach(stack -> {
|
||
|
+ ItemEntity droppedItem = new ItemEntity(level, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(), stack);
|
||
|
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(itemEntity.getBukkitEntity(), (org.bukkit.entity.Item) droppedItem.getBukkitEntity());
|
||
|
+ if (event.callEvent()) {
|
||
|
+ level.addFreshEntity(droppedItem);
|
||
|
+ }
|
||
|
+ });
|
||
|
+ // Paper end - call EntityDropItemEvent
|
||
|
}
|
||
|
}
|
||
|
}
|