[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.
This commit is contained in:
GJ 2014-01-26 01:05:27 -08:00 committed by Travis Watkins
parent 610c58c733
commit 7df7778ccb

View File

@ -1,5 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockPoweredRail extends BlockMinecartTrackAbstract { public class BlockPoweredRail extends BlockMinecartTrackAbstract {
protected BlockPoweredRail() { protected BlockPoweredRail() {
super(true); super(true);
@ -115,9 +117,21 @@ public class BlockPoweredRail extends BlockMinecartTrackAbstract {
boolean flag1 = false; boolean flag1 = false;
if (flag && (l & 0x8) == 0) { 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); world.setData(i, j, k, i1 | 0x8, 3);
flag1 = true; flag1 = true;
} else if (!flag && (l & 0x8) != 0) { } 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); world.setData(i, j, k, i1, 3);
flag1 = true; flag1 = true;
} }
@ -129,4 +143,4 @@ public class BlockPoweredRail extends BlockMinecartTrackAbstract {
} }
} }
} }
} }