2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/level/block/BlockLever.java
|
|
|
|
+++ b/net/minecraft/world/level/block/BlockLever.java
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -25,6 +25,8 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
|
|
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
|
|
+
|
2018-07-15 02:00:00 +02:00
|
|
|
public class BlockLever extends BlockAttachable {
|
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
|
|
|
|
@@ -92,6 +94,20 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2019-12-10 23:00:00 +01:00
|
|
|
return EnumInteractionResult.SUCCESS;
|
2014-11-25 22:32:16 +01:00
|
|
|
} else {
|
|
|
|
+ // CraftBukkit start - Interact Lever
|
2019-12-10 23:00:00 +01:00
|
|
|
+ boolean powered = iblockdata.get(BlockLever.POWERED); // Old powered state
|
2014-11-25 22:32:16 +01:00
|
|
|
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
|
|
+ int old = (powered) ? 15 : 0;
|
|
|
|
+ int current = (!powered) ? 15 : 0;
|
|
|
|
+
|
|
|
|
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
|
2021-06-11 13:33:49 +02:00
|
|
|
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
|
|
|
+ if ((eventRedstone.getNewCurrent() > 0) != (!powered)) {
|
2019-12-10 23:00:00 +01:00
|
|
|
+ return EnumInteractionResult.SUCCESS;
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2016-02-29 22:32:46 +01:00
|
|
|
+
|
2019-12-10 23:00:00 +01:00
|
|
|
iblockdata1 = this.d(iblockdata, world, blockposition);
|
|
|
|
float f = (Boolean) iblockdata1.get(BlockLever.POWERED) ? 0.6F : 0.5F;
|
2018-07-15 02:00:00 +02:00
|
|
|
|