diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/LeverBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/LeverBlock.java.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/LeverBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/LeverBlock.java.patch new file mode 100644 index 0000000000..fe17dcb9ed --- /dev/null +++ b/patch-remap/mache-spigotflower-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 +@@ -27,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 { + +@@ -104,11 +102,25 @@ + + return InteractionResult.SUCCESS; + } else { +- blockstate1 = this.pull(blockstate, level, blockpos); +- float f = (Boolean) blockstate1.getValue(LeverBlock.POWERED) ? 0.6F : 0.5F; ++ // 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; + +- level.playSound((Player) null, blockpos, SoundEvents.LEVER_CLICK, SoundSource.BLOCKS, 0.3F, f); +- level.gameEvent((Entity) player, (Boolean) blockstate1.getValue(LeverBlock.POWERED) ? GameEvent.BLOCK_ACTIVATE : GameEvent.BLOCK_DEACTIVATE, blockpos); ++ 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; + } + } |