summaryrefslogtreecommitdiffhomepage
path: root/patches
diff options
context:
space:
mode:
authorBrokkonaut <[email protected]>2024-09-27 18:27:14 +0200
committerGitHub <[email protected]>2024-09-27 18:27:14 +0200
commit01c4820450d4a1af15dbb0ced1f67fb40154faaa (patch)
tree77de308a388e3ef4c87595ca659283e557bed24d /patches
parent627cc64eeaa37fe93a3b3f4d6cec3a7374e957bb (diff)
downloadPaper-01c4820450d4a1af15dbb0ced1f67fb40154faaa.tar.gz
Paper-01c4820450d4a1af15dbb0ced1f67fb40154faaa.zip
Call EntityDropItemEvent when a container item drops its contents (#11441)
Diffstat (limited to 'patches')
-rw-r--r--patches/server/0718-Add-various-missing-EntityDropItemEvent-calls.patch23
1 files changed, 22 insertions, 1 deletions
diff --git a/patches/server/0718-Add-various-missing-EntityDropItemEvent-calls.patch b/patches/server/0718-Add-various-missing-EntityDropItemEvent-calls.patch
index 2a92fcdc52..2f42aa11cb 100644
--- a/patches/server/0718-Add-various-missing-EntityDropItemEvent-calls.patch
+++ b/patches/server/0718-Add-various-missing-EntityDropItemEvent-calls.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Add various missing EntityDropItemEvent calls
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
-index de483cc77931fcb1d8bb9b1bcfd6606706490fba..180a86c419cad9873c53a49c8881ced647a753e0 100644
+index 8b0959050cd5e0ef24347632c3b4184eadf565e6..73a69c35bca89ab82da39149a2a7cb86d4878e3c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2557,6 +2557,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -86,3 +86,24 @@ index 94df94f7acc121201966955a09fb336b0a98e599..d34d8fe70379dcad9540739ec0ae1c94
}
@Override
+diff --git a/src/main/java/net/minecraft/world/item/ItemUtils.java b/src/main/java/net/minecraft/world/item/ItemUtils.java
+index 66f88f44eb74dfbdafe0d6257dc1ef46238aaa92..4901f0d89ae2472bce7f242d9529236674f5d134 100644
+--- a/src/main/java/net/minecraft/world/item/ItemUtils.java
++++ b/src/main/java/net/minecraft/world/item/ItemUtils.java
+@@ -41,7 +41,15 @@ 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
+ }
+ }
+ }