geforkt von Mirrors/Paper
Call EntityDropItemEvent when a container item drops its contents (#11441)
Dieser Commit ist enthalten in:
Ursprung
4ffc9d9c0c
Commit
fb91090522
@ -86,3 +86,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemUtils.java b/src/main/java/net/minecraft/world/item/ItemUtils.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemUtils.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ItemUtils.java
|
||||
@@ -0,0 +0,0 @@ public class ItemUtils {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren