diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/LeverBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/LeverBlock.java.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/LeverBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/LeverBlock.java.patch new file mode 100644 index 0000000000..c922efe239 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/LeverBlock.java.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/world/level/block/LeverBlock.java ++++ b/net/minecraft/world/level/block/LeverBlock.java +@@ -26,6 +27,7 @@ + import net.minecraft.world.phys.BlockHitResult; + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.VoxelShape; ++import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit + + public class LeverBlock extends FaceAttachedHorizontalDirectionalBlock { + public static final MapCodec<LeverBlock> CODEC = simpleCodec(LeverBlock::new); +@@ -99,10 +102,25 @@ + + return InteractionResult.SUCCESS; + } else { +- BlockState blockState = this.pull(state, level, pos); +- float f = blockState.getValue(POWERED) ? 0.6F : 0.5F; +- level.playSound(null, pos, SoundEvents.LEVER_CLICK, SoundSource.BLOCKS, 0.3F, f); +- level.gameEvent(player, blockState.getValue(POWERED) ? GameEvent.BLOCK_ACTIVATE : GameEvent.BLOCK_DEACTIVATE, pos); ++ // CraftBukkit start - Interact Lever ++ boolean powered = state.getValue(LeverBlock.POWERED); // Old powered state ++ org.bukkit.block.Block block = level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); ++ int old = (powered) ? 15 : 0; ++ int current = (!powered) ? 15 : 0; ++ ++ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current); ++ level.getCraftServer().getPluginManager().callEvent(eventRedstone); ++ ++ if ((eventRedstone.getNewCurrent() > 0) != (!powered)) { ++ return InteractionResult.SUCCESS; ++ } ++ // CraftBukkit end ++ ++ iblockdata1 = this.pull(state, level, pos); ++ float f = (Boolean) iblockdata1.getValue(LeverBlock.POWERED) ? 0.6F : 0.5F; ++ ++ level.playSound((Player) null, pos, SoundEvents.LEVER_CLICK, SoundSource.BLOCKS, 0.3F, f); ++ level.gameEvent((Entity) player, (Boolean) iblockdata1.getValue(LeverBlock.POWERED) ? GameEvent.BLOCK_ACTIVATE : GameEvent.BLOCK_DEACTIVATE, pos); + return InteractionResult.CONSUME; + } + } |