Fix drops for shearing bogged (#11628)

This commit is contained in:
Lulu13022002 2024-11-19 11:05:54 +01:00
parent a8904bbf98
commit 1cc1ee1676
2 changed files with 20 additions and 3 deletions

View file

@ -257,7 +257,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ org.bukkit.event.player.PlayerShearEntityEvent event = CraftEventFactory.handlePlayerShearEntityEvent(player, this, itemstack, hand, drops);
+ if (event != null) {
+ if (event.isCancelled()) {
+ this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients
+ // this.getEntityData().markDirty(Bogged.DATA_SHEARED); // CraftBukkit - mark dirty to restore sheared state to clients // Paper - no longer needed
+ return InteractionResult.PASS;
+ }
+ drops = org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getDrops());
@ -296,15 +296,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
- private void spawnShearedMushrooms(ServerLevel world, ItemStack shears) {
- this.dropFromShearingLootTable(world, BuiltInLootTables.BOGGED_SHEAR, shears, (worldserver1, itemstack1) -> {
+ // Paper start - custom shear drops
+ private void spawnShearedMushrooms(ServerLevel world, ItemStack shears, java.util.List<ItemStack> drops) {
+ final ServerLevel worldserver1 = world; // Named for lambda consumption
this.forceDrops = true; // Paper - Add missing forceDrop toggles
- this.dropFromShearingLootTable(world, BuiltInLootTables.BOGGED_SHEAR, shears, (worldserver1, itemstack1) -> {
+ drops.forEach(itemstack1 -> {
+ // Paper end - custom shear drops
this.spawnAtLocation(worldserver1, itemstack1, this.getBbHeight());
});
}
this.forceDrops = false; // Paper - Add missing forceDrop toggles
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java

View file

@ -52,6 +52,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
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/Bogged.java b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Bogged.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Bogged.java
@@ -0,0 +0,0 @@ public class Bogged extends AbstractSkeleton implements Shearable {
}
private void spawnShearedMushrooms(ServerLevel world, ItemStack shears) {
+ this.forceDrops = true; // Paper - Add missing forceDrop toggles
this.dropFromShearingLootTable(world, BuiltInLootTables.BOGGED_SHEAR, shears, (worldserver1, itemstack1) -> {
this.spawnAtLocation(worldserver1, itemstack1, this.getBbHeight());
});
+ this.forceDrops = false; // Paper - Add missing forceDrop toggles
}
@Override
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/monster/piglin/Piglin.java