summaryrefslogtreecommitdiffstats
path: root/nms-patches/BlockPoweredRail.patch
blob: dd3fa0b436a158b2b7c4e9de5b00d59027695442 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--- /home/matt/mc-dev-private//net/minecraft/server/BlockPoweredRail.java	2015-02-26 22:40:22.211608143 +0000
+++ src/main/java/net/minecraft/server/BlockPoweredRail.java	2015-02-26 22:40:22.211608143 +0000
@@ -2,6 +2,8 @@
 
 import com.google.common.base.Predicate;
 
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
 public class BlockPoweredRail extends BlockMinecartTrackAbstract {
 
     public static final BlockStateEnum<BlockMinecartTrackAbstract.EnumTrackPosition> SHAPE = BlockStateEnum.a("shape", BlockMinecartTrackAbstract.EnumTrackPosition.class, new Predicate() {
@@ -116,6 +118,13 @@
         boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || this.a(world, blockposition, iblockdata, true, 0) || this.a(world, blockposition, iblockdata, false, 0);
 
         if (flag1 != flag) {
+            // CraftBukkit start
+            int power = (Boolean)iblockdata.get(POWERED) ? 15 : 0;
+            int newPower = CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), power, 15 - power).getNewCurrent();
+            if (newPower == power) {
+                return;
+            }
+            // CraftBukkit end
             world.setTypeAndData(blockposition, iblockdata.set(BlockPoweredRail.POWERED, Boolean.valueOf(flag1)), 3);
             world.applyPhysics(blockposition.down(), this);
             if (((BlockMinecartTrackAbstract.EnumTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) {