Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 02:50:09 +01:00
107 Zeilen
5.7 KiB
Diff
107 Zeilen
5.7 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/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java
|
|
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
|
|
@@ -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
|
|
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 a190826d87ca5e05c408ef488986a29280b1b3d2..4f03e50d8d9d67aa9a62fbb3bdb14f5ba851e08a 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
|
|
@@ -531,7 +531,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
|
|
}
|
|
|
|
}
|
|
@@ -655,7 +657,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));
|
|
@@ -932,7 +936,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
|
|
index 2c012e8d314e8b785300de3f810f95c7452b7348..7ef04ef7995b093eef022b397cda8c27c8faede0 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
|
|
@@ -322,7 +322,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
|
|
index 7611481c7e469a3b9eb4d00f4816adb7b190127e..092cdb889564903102dccfe7bf2e320a1eba5efe 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
|
|
@@ -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);
|
|
@@ -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
|
|
index 06d4c1787b1ee4976e6ed1773d3ff7130aebc2d0..9948085f51659f9b896622251739343d658dd0b2 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);
|