From 219d159e4da9ba32079ee2efb996c4882228a033 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Wed, 26 Oct 2022 17:32:03 -0700 Subject: [PATCH] Fix a bunch more forceDrops for dropping items (#8095) --- ...a-bunch-of-missing-forceDrop-toggles.patch | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/patches/server/Add-a-bunch-of-missing-forceDrop-toggles.patch b/patches/server/Add-a-bunch-of-missing-forceDrop-toggles.patch index 5fbe74c67b..6b25856248 100644 --- a/patches/server/Add-a-bunch-of-missing-forceDrop-toggles.patch +++ b/patches/server/Add-a-bunch-of-missing-forceDrop-toggles.patch @@ -32,6 +32,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } +@@ -0,0 +0,0 @@ public class Panda extends Animal { + ItemStack itemstack1 = this.getItemBySlot(EquipmentSlot.MAINHAND); + + if (!itemstack1.isEmpty() && !player.getAbilities().instabuild) { ++ this.forceDrops = true; // Paper + this.spawnAtLocation(itemstack1); ++ this.forceDrops = false; // Paper + } + + this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemstack.getItem(), 1)); +@@ -0,0 +0,0 @@ public class Panda extends Animal { + ItemStack itemstack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND); + + if (!itemstack.isEmpty()) { ++ Panda.this.forceDrops = true; // Paper + Panda.this.spawnAtLocation(itemstack); ++ Panda.this.forceDrops = false; // Paper + Panda.this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY); + int i = Panda.this.isLazy() ? Panda.this.random.nextInt(50) + 10 : Panda.this.random.nextInt(150) + 10; + diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java @@ -46,3 +66,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 super.finishConversion(world); } +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +@@ -0,0 +0,0 @@ public class PiglinAi { + + private static void holdInOffhand(Piglin piglin, ItemStack stack) { + if (PiglinAi.isHoldingItemInOffHand(piglin)) { ++ piglin.forceDrops = true; // Paper + piglin.spawnAtLocation(piglin.getItemInHand(InteractionHand.OFF_HAND)); ++ piglin.forceDrops = false; // Paper + } + + piglin.holdInOffHand(stack); +@@ -0,0 +0,0 @@ public class PiglinAi { + + protected static void cancelAdmiring(Piglin piglin) { + if (PiglinAi.isAdmiringItem(piglin) && !piglin.getOffhandItem().isEmpty()) { ++ piglin.forceDrops = true; // Paper + piglin.spawnAtLocation(piglin.getOffhandItem()); ++ piglin.forceDrops = false; // Paper + piglin.setItemInHand(InteractionHand.OFF_HAND, ItemStack.EMPTY); + } + +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 ++++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java +@@ -0,0 +0,0 @@ public abstract class Raider extends PatrollingMonster { + double d0 = (double) this.getEquipmentDropChance(enumitemslot); + + if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) { ++ this.forceDrops = true; // Paper + this.spawnAtLocation(itemstack1); ++ this.forceDrops = false; // Paper + } + + this.onItemPickup(item);