aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/unapplied/server/0614-prevent-unintended-light-block-manipulation.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/unapplied/server/0614-prevent-unintended-light-block-manipulation.patch')
-rw-r--r--patches/unapplied/server/0614-prevent-unintended-light-block-manipulation.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/patches/unapplied/server/0614-prevent-unintended-light-block-manipulation.patch b/patches/unapplied/server/0614-prevent-unintended-light-block-manipulation.patch
new file mode 100644
index 0000000000..b8ca205064
--- /dev/null
+++ b/patches/unapplied/server/0614-prevent-unintended-light-block-manipulation.patch
@@ -0,0 +1,25 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+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 6c3ca57a29d3c5ad1add1cf2f707b930dfc422ea..fec6bf38f080039436ba80d5528857ba4787bf4e 100644
+--- a/src/main/java/net/minecraft/world/level/block/LightBlock.java
++++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java
+@@ -50,6 +50,14 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
+ builder.add(LEVEL, WATERLOGGED);
+ }
+
++ // Paper start - prevent unintended light block manipulation
++ @Override
++ protected InteractionResult useItemOn(ItemStack stack, BlockState state, Level world, BlockPos pos, Player player, net.minecraft.world.InteractionHand hand, BlockHitResult hit) {
++ if (player.getItemInHand(hand).getItem() != Items.LIGHT || (world instanceof final net.minecraft.server.level.ServerLevel serverLevel && !player.mayInteract(serverLevel, pos)) || !player.mayUseItemAt(pos, hit.getDirection(), player.getItemInHand(hand))) { return net.minecraft.world.InteractionResult.PASS; } // Paper - Prevent unintended light block manipulation
++ return super.useItemOn(stack, state, world, pos, player, hand, hit);
++ }
++ // Paper end - prevent unintended light block manipulation
++
+ @Override
+ protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
+ if (!world.isClientSide && player.canUseGameMasterBlocks()) {