mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-25 13:56:14 +00:00
33 lines
1.4 KiB
Diff
33 lines
1.4 KiB
Diff
--- a/net/minecraft/world/level/block/BlockLever.java
|
|
+++ b/net/minecraft/world/level/block/BlockLever.java
|
|
@@ -32,6 +32,8 @@
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
|
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
+
|
|
public class BlockLever extends BlockAttachable {
|
|
|
|
public static final MapCodec<BlockLever> CODEC = simpleCodec(BlockLever::new);
|
|
@@ -102,6 +104,20 @@
|
|
makeParticle(iblockdata1, world, blockposition, 1.0F);
|
|
}
|
|
} else {
|
|
+ // CraftBukkit start - Interact Lever
|
|
+ boolean powered = iblockdata.getValue(BlockLever.POWERED); // Old powered state
|
|
+ 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);
|
|
+ world.getCraftServer().getPluginManager().callEvent(eventRedstone);
|
|
+
|
|
+ if ((eventRedstone.getNewCurrent() > 0) != (!powered)) {
|
|
+ return EnumInteractionResult.SUCCESS;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
this.pull(iblockdata, world, blockposition, (EntityHuman) null);
|
|
}
|
|
|