Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 21:10:17 +01:00
33 Zeilen
1.4 KiB
Diff
33 Zeilen
1.4 KiB
Diff
--- a/net/minecraft/server/BlockLever.java
|
|
+++ b/net/minecraft/server/BlockLever.java
|
|
@@ -2,6 +2,8 @@
|
|
|
|
import java.util.Iterator;
|
|
|
|
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
|
|
+
|
|
public class BlockLever extends Block {
|
|
|
|
public static final BlockStateEnum<BlockLever.EnumLeverPosition> FACING = BlockStateEnum.of("facing", BlockLever.EnumLeverPosition.class);
|
|
@@ -127,6 +129,20 @@
|
|
if (world.isClientSide) {
|
|
return true;
|
|
} else {
|
|
+ // CraftBukkit start - Interact Lever
|
|
+ boolean powered = iblockdata.get(POWERED);
|
|
+ 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.getServer().getPluginManager().callEvent(eventRedstone);
|
|
+
|
|
+ if ((eventRedstone.getNewCurrent() > 0) != (!powered)) {
|
|
+ return true;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
iblockdata = iblockdata.a((IBlockState) BlockLever.POWERED);
|
|
world.setTypeAndData(blockposition, iblockdata, 3);
|
|
float f3 = ((Boolean) iblockdata.get(BlockLever.POWERED)).booleanValue() ? 0.6F : 0.5F;
|