Add missing forceDrop toggles

This commit is contained in:
Jake Potrebic
2021-07-20 21:25:35 -07:00
parent a600754f0d
commit 29ce813416
6 changed files with 125 additions and 32 deletions

View File

@@ -22,7 +22,17 @@
}
}
@@ -541,14 +548,14 @@
@@ -533,7 +540,9 @@
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
}
}
@@ -541,14 +550,14 @@
@Override
protected void pickUpItem(ServerLevel world, ItemEntity itemEntity) {
@@ -39,7 +49,17 @@
}
}
@@ -772,7 +779,7 @@
@@ -657,7 +666,9 @@
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));
@@ -772,7 +783,7 @@
}
public static Panda.Gene byName(String name) {
@@ -48,7 +68,7 @@
}
public static Panda.Gene getRandom(RandomSource random) {
@@ -876,10 +883,10 @@
@@ -876,10 +887,10 @@
private final Panda panda;
public PandaAvoidGoal(Panda panda, Class<T> fleeFromType, float distance, double slowSpeed, double fastSpeed) {
@@ -62,7 +82,17 @@
this.panda = panda;
}
@@ -1116,7 +1123,7 @@
@@ -935,7 +946,9 @@
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;
@@ -1116,7 +1129,7 @@
@Override
protected void alertOther(Mob mob, LivingEntity target) {
if (mob instanceof Panda && mob.isAggressive()) {