diff options
author | Jake Potrebic <[email protected]> | 2024-04-06 18:52:05 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-04-10 14:04:47 -0700 |
commit | c1166f5d0d73723d8e7bad1a158a96a21835c5c2 (patch) | |
tree | 7af29e745260ce62664bfd2be7aaaf28c06eed60 /patches/server/0462-Add-PlayerShearBlockEvent.patch | |
parent | 5436d44bf2509ff89129f8790ee4643f09c72871 (diff) | |
download | Paper-c1166f5d0d73723d8e7bad1a158a96a21835c5c2.tar.gz Paper-c1166f5d0d73723d8e7bad1a158a96a21835c5c2.zip |
Update patches to handle vineflower decompiler
Diffstat (limited to 'patches/server/0462-Add-PlayerShearBlockEvent.patch')
-rw-r--r-- | patches/server/0462-Add-PlayerShearBlockEvent.patch | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/patches/server/0462-Add-PlayerShearBlockEvent.patch b/patches/server/0462-Add-PlayerShearBlockEvent.patch index 140bb100a4..5c56301158 100644 --- a/patches/server/0462-Add-PlayerShearBlockEvent.patch +++ b/patches/server/0462-Add-PlayerShearBlockEvent.patch @@ -39,10 +39,10 @@ index 44e72176a0da08a77fa192ee31c0fcd53f0dc22d..27f1c1ac12251f1438ee8bf14f4afb5f entityhuman1.broadcastBreakEvent(hand); }); 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 df11efd22682c2ed799dabf15d2cfa5973e8dca9..cc13b74fa37b5df6fe6f1423496b9fb03d71d083 100644 +index e2e13874bf41178228d0414ea51167cd6aa23053..88dfa1eb8b4c588aafffed7b8e8b68e0bae28f4b 100644 --- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java -@@ -35,13 +35,24 @@ public class PumpkinBlock extends Block { +@@ -35,16 +35,24 @@ public class PumpkinBlock extends Block { ItemStack itemStack = player.getItemInHand(hand); if (itemStack.is(Items.SHEARS)) { if (!world.isClientSide) { @@ -55,16 +55,24 @@ index df11efd22682c2ed799dabf15d2cfa5973e8dca9..cc13b74fa37b5df6fe6f1423496b9fb0 + // Paper end - Add PlayerShearBlockEvent Direction direction = hit.getDirection(); Direction direction2 = direction.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : direction; - world.playSound((Player)null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); + world.playSound(null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); world.setBlock(pos, Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, direction2), 11); -- ItemEntity itemEntity = new ItemEntity(world, (double)pos.getX() + 0.5D + (double)direction2.getStepX() * 0.65D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D + (double)direction2.getStepZ() * 0.65D, new ItemStack(Items.PUMPKIN_SEEDS, 4)); -+ // Paper start - Add PlayerShearBlockEvent -+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { -+ ItemEntity itemEntity = new ItemEntity(world, (double) pos.getX() + 0.5D + (double) direction2.getStepX() * 0.65D, (double) pos.getY() + 0.1D, (double) pos.getZ() + 0.5D + (double) direction2.getStepZ() * 0.65D, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item)); -+ // Paper end - Add PlayerShearBlockEvent - itemEntity.setDeltaMovement(0.05D * (double)direction2.getStepX() + world.random.nextDouble() * 0.02D, 0.05D, 0.05D * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02D); ++ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { // Paper - Add PlayerShearBlockEvent + 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, +@@ -52,6 +60,7 @@ public class PumpkinBlock extends Block { + 0.05 * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02 + ); world.addFreshEntity(itemEntity); + } // Paper - Add PlayerShearBlockEvent - itemStack.hurtAndBreak(1, player, (playerx) -> { + itemStack.hurtAndBreak(1, player, playerx -> { playerx.broadcastBreakEvent(hand); }); |