From 403db04ae430be8d0f265deff3226d7e73c28a09 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Sun, 25 Aug 2024 19:27:31 +0200 Subject: [PATCH] Prevent duplicate pickup event for piglins (#11322) --- patches/server/EntityPickupItemEvent-fixes.patch | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/patches/server/EntityPickupItemEvent-fixes.patch b/patches/server/EntityPickupItemEvent-fixes.patch index 7b0007f89d..21e27d5560 100644 --- a/patches/server/EntityPickupItemEvent-fixes.patch +++ b/patches/server/EntityPickupItemEvent-fixes.patch @@ -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