Extend HumanEntity#dropItem API (#11810)

This commit is contained in:
Strokkur24
2024-12-28 23:47:21 +01:00
committed by GitHub
parent 18da1ae4c0
commit 93a3df085c
4 changed files with 168 additions and 6 deletions

View File

@@ -112,16 +112,21 @@
this.removeEntitiesOnShoulder();
}
}
@@ -717,6 +_,13 @@
@@ -717,6 +_,18 @@
@Nullable
public ItemEntity drop(ItemStack droppedItem, boolean dropAround, boolean includeThrowerName) {
+ // CraftBukkit start - SPIGOT-2942: Add boolean to call event
+ return this.drop(droppedItem, dropAround, includeThrowerName, true);
+ return this.drop(droppedItem, dropAround, includeThrowerName, true, null);
+ }
+
+ @Nullable
+ public ItemEntity drop(ItemStack droppedItem, boolean dropAround, boolean includeThrowerName, boolean callEvent) {
+ return this.drop(droppedItem, dropAround, includeThrowerName, callEvent, null);
+ }
+
+ @Nullable
+ public ItemEntity drop(ItemStack droppedItem, boolean dropAround, boolean includeThrowerName, boolean callEvent, @Nullable java.util.function.Consumer<org.bukkit.entity.Item> entityOperation) {
+ // CraftBukkit end
if (!droppedItem.isEmpty() && this.level().isClientSide) {
this.swing(InteractionHand.MAIN_HAND);