mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-22 22:45:31 +01:00
108 lines
6.5 KiB
Diff
108 lines
6.5 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 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);
|