mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +01:00
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
18 lines
1.3 KiB
Diff
18 lines
1.3 KiB
Diff
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
|
|
index a0fadee4be7c263ceaf1f4a987169b0f50308072..a847b79da488c9d6059c9da941a50de8b1bfc24f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/LightBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java
|
|
@@ -54,6 +54,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 {
|