2021-10-01 13:07:59 +02:00
|
|
|
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-01-19 12:30:04 +01:00
|
|
|
index a0fadee4be7c263ceaf1f4a987169b0f50308072..a847b79da488c9d6059c9da941a50de8b1bfc24f 100644
|
2021-10-01 13:07:59 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/LightBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java
|
2023-12-06 16:17:00 +01:00
|
|
|
@@ -54,6 +54,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock {
|
2021-10-01 13:07:59 +02:00
|
|
|
@Override
|
|
|
|
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
2022-12-07 22:05:01 +01:00
|
|
|
if (!world.isClientSide && player.canUseGameMasterBlocks()) {
|
2024-01-19 12:30:04 +01:00
|
|
|
+ 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
|
2021-10-01 13:07:59 +02:00
|
|
|
world.setBlock(pos, state.cycle(LEVEL), 2);
|
|
|
|
return InteractionResult.SUCCESS;
|
|
|
|
} else {
|