Prevent duplicate pickup event for piglins (#11322)

This commit is contained in:
Lulu13022002 2024-08-25 19:27:31 +02:00 committed by GitHub
parent 956b3d1c4e
commit 5625051564
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,7 +25,7 @@ index d2dfa49e124460f4762b950f9ded106d2ec15dc2..bc58323801ee16fe9b63c21332144ec0
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
index d3d50ec0f4466464c048449d8a844569c447d59b..0192b62fd66621a72fcf2f20896647e5950ba993 100644
index d3d50ec0f4466464c048449d8a844569c447d59b..b9810a1f6ac91ae9631dd1ebc225f009d91b7845 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@@ -242,11 +242,16 @@ public class PiglinAi {
@ -46,6 +46,15 @@ index d3d50ec0f4466464c048449d8a844569c447d59b..0192b62fd66621a72fcf2f20896647e5
piglin.take(drop, 1);
itemstack = PiglinAi.removeOneItemFromItemEntity(drop);
} else {
@@ -261,7 +266,7 @@ 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 174d246b0a4d0fc9d769aad08da627ca8487bdf2..bbf21ea433f9e3963aac0ede597ed8d3c8e50ed8 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java