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

107 lines
5.7 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/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
2023-03-14 21:25:13 +01:00
index ac0cfdef53ec82665acf362235842de4f17bfdd1..05c1e8c9f013547d4fcdbbd299329166a8ece1b0 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
2023-03-14 21:25:13 +01:00
@@ -87,7 +87,9 @@ public class WorkAtComposter extends WorkAtPoi {
simpleContainer.removeItemType(Items.WHEAT, m);
ItemStack itemStack = simpleContainer.addItem(new ItemStack(Items.BREAD, l));
if (!itemStack.isEmpty()) {
+ entity.forceDrops = true; // Paper
2023-03-14 21:25:13 +01:00
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
2022-12-07 21:16:54 +01:00
index 2db5d8a937c841718e7b568c215109c39775d82c..0a18108fda778af5b600f77533770bd98584d60e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
2022-12-07 21:16:54 +01:00
@@ -528,7 +528,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
}
}
2022-12-07 21:16:54 +01:00
@@ -652,7 +654,9 @@ 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));
2022-12-07 21:16:54 +01:00
@@ -929,7 +933,9 @@ 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
2022-12-07 21:16:54 +01:00
index 035c0ff01000f3fd57e1fcab13b93cafb133a169..7b42f7bd100808cb2367d0d7c7361e8f2e597502 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
2022-12-07 21:16:54 +01:00
@@ -325,7 +325,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);
}
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
2022-12-07 21:16:54 +01:00
index e6d398f07564b4027552db9836e6da2c0972cd42..a3c28f327627b340905ba61238ce8454db0ec9ee 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
2022-12-07 21:16:54 +01:00
@@ -270,7 +270,9 @@ 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);
2022-12-07 21:16:54 +01:00
@@ -330,7 +332,9 @@ 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
2023-03-14 21:25:13 +01:00
index 50010cc6774c351539cf09e517b7967f45822ec8..da37c51ee443c2f1191a32671912a967a13003cf 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raider.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raider.java
@@ -250,7 +250,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
this.spawnAtLocation(itemstack1);
+ this.forceDrops = false; // Paper
}
this.onItemPickup(item);