Fix PlayerShearBlockEvent drops ignored for Pumpkin (#10956)

This commit is contained in:
Pedro 2024-06-22 09:50:47 -04:00 committed by GitHub
parent 19105a9019
commit 77c763b5ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,10 +39,10 @@ index c4b9c574bfb034fc78a596367f0f41dbde5eb93d..8d6736003934c5958f600660bdee58b3
flag = true;
world.gameEvent((Entity) player, (Holder) GameEvent.SHEAR, pos);
diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
index aa8667f0b14dc8944dd3457b431162e59bf54ada..3b94888516e4dd1a8e56c31fd71bb21f84b8cfbd 100644
index aa8667f0b14dc8944dd3457b431162e59bf54ada..5f5b2dd2bb45a0d3ae7de063b3bc611d01af21c0 100644
--- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java
@@ -40,10 +40,18 @@ public class PumpkinBlock extends Block {
@@ -40,16 +40,24 @@ public class PumpkinBlock extends Block {
} else if (world.isClientSide) {
return ItemInteractionResult.sidedSuccess(world.isClientSide);
} else {
@ -61,6 +61,13 @@ index aa8667f0b14dc8944dd3457b431162e59bf54ada..3b94888516e4dd1a8e56c31fd71bb21f
ItemEntity itemEntity = new ItemEntity(
world,
(double)pos.getX() + 0.5 + (double)direction2.getStepX() * 0.65,
(double)pos.getY() + 0.1,
(double)pos.getZ() + 0.5 + (double)direction2.getStepZ() * 0.65,
- new ItemStack(Items.PUMPKIN_SEEDS, 4)
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item) // Paper - Add PlayerShearBlockEvent
);
itemEntity.setDeltaMovement(
0.05 * (double)direction2.getStepX() + world.random.nextDouble() * 0.02,
@@ -57,6 +65,7 @@ public class PumpkinBlock extends Block {
0.05 * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02
);