PaperMC/nms-patches/BlockRedstoneWire.patch
2015-03-04 09:48:58 +00:00

36 lines
1.5 KiB
Diff

--- /home/matt/mc-dev-private//net/minecraft/server/BlockRedstoneWire.java 2015-02-26 22:40:22.239608143 +0000
+++ src/main/java/net/minecraft/server/BlockRedstoneWire.java 2015-02-26 22:40:22.239608143 +0000
@@ -8,6 +8,8 @@
import java.util.Random;
import java.util.Set;
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
public class BlockRedstoneWire extends Block {
public static final BlockStateEnum<BlockRedstoneWire.EnumRedstoneWireConnection> NORTH = BlockStateEnum.of("north", BlockRedstoneWire.EnumRedstoneWireConnection.class);
@@ -124,6 +126,15 @@
j = k;
}
+ // CraftBukkit start
+ if (i != j) {
+ BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i, j);
+ world.getServer().getPluginManager().callEvent(event);
+
+ j = event.getNewCurrent();
+ }
+ // CraftBukkit end
+
if (i != j) {
iblockdata = iblockdata.set(BlockRedstoneWire.POWER, Integer.valueOf(j));
if (world.getType(blockposition) == iblockdata1) {
@@ -232,7 +243,7 @@
}
}
- private int getPower(World world, BlockPosition blockposition, int i) {
+ public int getPower(World world, BlockPosition blockposition, int i) { // CraftBukkit - public
if (world.getType(blockposition).getBlock() != this) {
return i;
} else {