3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 12:30:06 +01:00
Paper/nms-patches/BlockLever.patch

33 Zeilen
1.4 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockLever.java
+++ b/net/minecraft/server/BlockLever.java
2016-05-10 13:47:39 +02:00
@@ -3,6 +3,8 @@
import java.util.Iterator;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockLever extends Block {
2015-02-26 23:41:06 +01:00
public static final BlockStateEnum<BlockLever.EnumLeverPosition> FACING = BlockStateEnum.of("facing", BlockLever.EnumLeverPosition.class);
2016-05-10 13:47:39 +02:00
@@ -129,6 +131,20 @@
2015-02-26 23:41:06 +01:00
if (world.isClientSide) {
return true;
} else {
+ // CraftBukkit start - Interact Lever
2015-02-26 23:41:06 +01:00
+ 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
2016-02-29 22:32:46 +01:00
+
iblockdata = iblockdata.a((IBlockState) BlockLever.POWERED);
world.setTypeAndData(blockposition, iblockdata, 3);
2016-02-29 22:32:46 +01:00
float f3 = ((Boolean) iblockdata.get(BlockLever.POWERED)).booleanValue() ? 0.6F : 0.5F;