aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0561-Add-missing-forceDrop-toggles.patch
blob: acc8574a813548d9d4ac6d7f6245f73d186b6ded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Tue, 20 Jul 2021 21:25:35 -0700
Subject: [PATCH] Add missing forceDrop toggles


diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
index 4ec1f881c05d96d72814ac3dffd3b4bef40c1bce..c34cb8c918e400636856317cc58356d2677e1d52 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
@@ -86,7 +86,9 @@ public class WorkAtComposter extends WorkAtPoi {
                 simpleContainer.removeItemType(Items.WHEAT, m);
                 ItemStack itemStack = simpleContainer.addItem(new ItemStack(Items.BREAD, l));
                 if (!itemStack.isEmpty()) {
+                    villager.forceDrops = true; // Paper - Add missing forceDrop toggles
                     villager.spawnAtLocation(world, itemStack, 0.5F);
+                    villager.forceDrops = false; // Paper - Add missing forceDrop toggles
                 }
             }
         }
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index 705c26ceff9371b09311bd7fa796c0efde7ebfee..4f04170b3ec4ff59358e10ccfd0799af3ab590c3 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -540,7 +540,9 @@ public class Panda extends Animal {
 
         if (world1 instanceof ServerLevel worldserver) {
             if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+                this.forceDrops = true; // Paper - Add missing forceDrop toggles
                 this.dropFromGiftLootTable(worldserver, BuiltInLootTables.PANDA_SNEEZE, this::spawnAtLocation);
+                this.forceDrops = false; // Paper - Add missing forceDrop toggles
             }
         }
 
@@ -664,7 +666,9 @@ public class Panda extends Animal {
                         ItemStack itemstack1 = this.getItemBySlot(EquipmentSlot.MAINHAND);
 
                         if (!itemstack1.isEmpty() && !player.hasInfiniteMaterials()) {
+                            this.forceDrops = true; // Paper - Add missing forceDrop toggles
                             this.spawnAtLocation(worldserver, itemstack1);
+                            this.forceDrops = false; // Paper - Add missing forceDrop toggles
                         }
 
                         this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(itemstack.getItem(), 1));
@@ -942,7 +946,9 @@ public class Panda extends Animal {
             ItemStack itemstack = Panda.this.getItemBySlot(EquipmentSlot.MAINHAND);
 
             if (!itemstack.isEmpty()) {
+                Panda.this.forceDrops = true; // Paper - Add missing forceDrop toggles
                 Panda.this.spawnAtLocation(getServerLevel(Panda.this.level()), itemstack);
+                Panda.this.forceDrops = false; // Paper - Add missing forceDrop toggles
                 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 ec733e71e41a4c89ed9f35ad1d9d4fa912160d27..15a49e3541c8b45db5e472a64fa0cb94c5a72f67 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -323,9 +323,11 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
     @Override
     protected void finishConversion(ServerLevel world) {
         PiglinAi.cancelAdmiring(world, this);
+        this.forceDrops = true; // Paper - Add missing forceDrop toggles
         this.inventory.removeAllItems().forEach((itemstack) -> {
             this.spawnAtLocation(world, itemstack);
         });
+        this.forceDrops = false; // Paper - Add missing forceDrop toggles
         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 42b1bd58c6e2c3bd1170171eabfefe315202f340..55868c82bf8bd61ce3494aa9f363c20c88ec6aa6 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
@@ -273,7 +273,9 @@ public class PiglinAi {
 
     private static void holdInOffhand(ServerLevel world, Piglin piglin, ItemStack stack) {
         if (PiglinAi.isHoldingItemInOffHand(piglin)) {
+            piglin.forceDrops = true; // Paper - Add missing forceDrop toggles
             piglin.spawnAtLocation(world, piglin.getItemInHand(InteractionHand.OFF_HAND));
+            piglin.forceDrops = false; // Paper - Add missing forceDrop toggles
         }
 
         piglin.holdInOffHand(stack);
@@ -333,7 +335,9 @@ public class PiglinAi {
 
     protected static void cancelAdmiring(ServerLevel world, Piglin piglin) {
         if (PiglinAi.isAdmiringItem(piglin) && !piglin.getOffhandItem().isEmpty()) {
+            piglin.forceDrops = true; // Paper - Add missing forceDrop toggles
             piglin.spawnAtLocation(world, piglin.getOffhandItem());
+            piglin.forceDrops = false; // Paper - Add missing forceDrop toggles
             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 6ac2351b3476aa04872196836ce00c622adab315..45375ccdcf730732dd915304dea2f523807eedd6 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -233,7 +233,9 @@ 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 - Add missing forceDrop toggles
                 this.spawnAtLocation(world, itemstack1);
+                this.forceDrops = false; // Paper - Add missing forceDrop toggles
             }
 
             this.onItemPickup(itemEntity);