PaperMC/patches/server/0644-prevent-unintended-light-block-manipulation.patch

19 lines
1.3 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
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
2024-04-24 17:27:28 +02:00
index 01722473a4861533dba0ab6edf3982c0278c41e1..a57dd6a6815a83c6a9e7d9eb75e4fccc014e6fac 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
2024-04-24 17:27:28 +02:00
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
2022-12-07 22:05:01 +01:00
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 {