From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Mon, 13 Sep 2021 18:55:45 -0700 Subject: [PATCH] prevent unintended light block manipulation diff --git a/src/main/java/net/minecraft/world/level/block/LightBlock.java b/src/main/java/net/minecraft/world/level/block/LightBlock.java index 0fe3186b4edbbc93f5794d23dffe58c063be8d67..95d36c3a74d0b71662864f27c54cf52ba41d384c 100644 --- a/src/main/java/net/minecraft/world/level/block/LightBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java @@ -52,6 +52,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock { @Override public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { if (!world.isClientSide && player.canUseGameMasterBlocks()) { + if (player.getItemInHand(hand).getItem() != Items.LIGHT || !player.mayInteract(world, pos) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return InteractionResult.FAIL; } // Paper - Prevent unintended light block manipulation world.setBlock(pos, state.cycle(LEVEL), 2); return InteractionResult.SUCCESS; } else {