From 7df7778ccb13aab76f672f06eea021d2d6020808 Mon Sep 17 00:00:00 2001 From: GJ Date: Sun, 26 Jan 2014 01:05:27 -0800 Subject: [PATCH] [Bleeding] Call BlockRedstoneEvent for all rails. Adds BUKKIT-4080 Previously, Detector Rails were the only rails that properly called BlockRedstoneEvent when they changed from powered to unpowered. This commit adds BlockRedstoneEvent calls for both Powered Rails and Activator Rails. --- .../net/minecraft/server/BlockPoweredRail.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/BlockPoweredRail.java b/src/main/java/net/minecraft/server/BlockPoweredRail.java index aa84a975ad..cd20905862 100644 --- a/src/main/java/net/minecraft/server/BlockPoweredRail.java +++ b/src/main/java/net/minecraft/server/BlockPoweredRail.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit + public class BlockPoweredRail extends BlockMinecartTrackAbstract { protected BlockPoweredRail() { super(true); @@ -115,9 +117,21 @@ public class BlockPoweredRail extends BlockMinecartTrackAbstract { boolean flag1 = false; if (flag && (l & 0x8) == 0) { + // CraftBukkit start + if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() <= 0) { + return; + } + // CraftBukkit end + world.setData(i, j, k, i1 | 0x8, 3); flag1 = true; } else if (!flag && (l & 0x8) != 0) { + // CraftBukkit start + if (CraftEventFactory.callRedstoneChange(world, i, j, k, 15, 0).getNewCurrent() > 0) { + return; + } + // CraftBukkit end + world.setData(i, j, k, i1, 3); flag1 = true; } @@ -129,4 +143,4 @@ public class BlockPoweredRail extends BlockMinecartTrackAbstract { } } } -} \ No newline at end of file +}