Prevent duplicate pickup event for piglins (#11322)

This commit is contained in:
Lulu13022002 2024-08-25 19:27:31 +02:00
parent 5f317598d4
commit 403db04ae4

View file

@ -46,6 +46,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
piglin.take(drop, 1);
itemstack = PiglinAi.removeOneItemFromItemEntity(drop);
} else {
@@ -0,0 +0,0 @@ public class PiglinAi {
} else if (PiglinAi.isFood(itemstack) && !PiglinAi.hasEatenRecently(piglin)) {
PiglinAi.eat(piglin);
} else {
- boolean flag = !piglin.equipItemIfPossible(itemstack, drop).equals(ItemStack.EMPTY); // CraftBukkit
+ boolean flag = !piglin.equipItemIfPossible(itemstack, null).equals(ItemStack.EMPTY); // CraftBukkit // Paper - pass null item entity to prevent duplicate pickup item event call - called above.
if (!flag) {
PiglinAi.putInInventory(piglin, itemstack);
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java