From f905057070b0a272c281ff767adcea3a0aca9601 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <15055071+Machine-Maker@users.noreply.github.com> Date: Fri, 1 Oct 2021 04:07:59 -0700 Subject: [PATCH] Prevent unintended light block manipulation (#6601) --- ...t-unintended-light-block-manipulation.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 patches/server/0813-prevent-unintended-light-block-manipulation.patch diff --git a/patches/server/0813-prevent-unintended-light-block-manipulation.patch b/patches/server/0813-prevent-unintended-light-block-manipulation.patch new file mode 100644 index 000000000..ba7dcc0e9 --- /dev/null +++ b/patches/server/0813-prevent-unintended-light-block-manipulation.patch @@ -0,0 +1,18 @@ +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 7f4acaab7e77f5184c8f8a30ed13b34949780227..59faf48727cfbccacdd5ffa067758466a240e90a 100644 +--- a/src/main/java/net/minecraft/world/level/block/LightBlock.java ++++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java +@@ -46,6 +46,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) { ++ if (player.getItemInHand(hand).getItem() != Items.LIGHT || !player.mayInteract(world, pos) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return InteractionResult.FAIL; } // Paper + world.setBlock(pos, state.cycle(LEVEL), 2); + return InteractionResult.SUCCESS; + } else {