PaperMC/patches/unapplied/server/0721-Add-a-bunch-of-missing-forceDrop-toggles.patch
2021-11-30 19:26:33 +01:00

62 lines
3.2 KiB
Diff

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 dadc202da2d5568dce051b9cb4aadf20cfdd2c4f..8a2c49b7ded2165e383cd9b8744f752754aabdf4 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 d4efcf08148933902d726cad05fc5d1bcb41ae8f..37712fe8585ede00569026bba5377ab61ad08ff5 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);
}