Paper/patches/server/0723-Add-a-bunch-of-missing-forceDrop-toggles.patch

63 lines
3.2 KiB
Diff
Raw Normal View History

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 a bunch of missing forceDrop toggles
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index c375081e02925da6085a2d433bfc2c3719770f78..a8e5be1c941755b3e5b335d8211ca70a6c6fc32f 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1474,7 +1474,9 @@ public abstract class Mob extends LivingEntity {
}
if (this.tickCount > 100) {
+ this.forceDrops = true; // Paper
this.spawnAtLocation((ItemLike) Items.LEAD);
+ this.forceDrops = false; // Paper
this.leashInfoTag = null;
}
}
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 89c53df5a745a5712c3c74030ed942c3102f3725..aba1b220826c7680892a93c1733ad32dc8a0a23f 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
@@ -100,7 +100,9 @@ public class WorkAtComposter extends WorkAtPoi {
ItemStack itemstack = inventorysubcontainer.addItem(new ItemStack(Items.BREAD, j));
if (!itemstack.isEmpty()) {
+ entity.forceDrops = true; // Paper
entity.spawnAtLocation(itemstack, 0.5F);
+ entity.forceDrops = false; // Paper
}
}
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 851ee58e52c6003d6ae7b58c9b6b9a9a9795fa85..12ed864bedf2201fad68e2aeba249c3c18a12444 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -521,7 +521,9 @@ public class Panda extends Animal {
}
if (!this.level.isClientSide() && this.random.nextInt(700) == 0 && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
+ this.forceDrops = true; // Paper
this.spawnAtLocation((ItemLike) Items.SLIME_BALL);
+ this.forceDrops = false; // Paper
}
}
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 adc2feafd0c1a38d1b6b65b8aee59d21725b84fe..c7ad0e317c0c74e5ad3e08278c5e7b31c894413e 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
@@ -306,7 +306,9 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
@Override
protected void finishConversion(ServerLevel world) {
PiglinAi.cancelAdmiring(this);
+ this.forceDrops = true; // Paper
this.inventory.removeAllItems().forEach(this::spawnAtLocation);
+ this.forceDrops = false; // Paper
super.finishConversion(world);
}