13
0
geforkt von Mirrors/Paper
Paper/nms-patches/BlockPoweredRail.patch

26 Zeilen
1.4 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockPoweredRail.java
+++ b/net/minecraft/server/BlockPoweredRail.java
2016-05-10 13:47:39 +02:00
@@ -3,6 +3,8 @@
import com.google.common.base.Predicate;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockPoweredRail extends BlockMinecartTrackAbstract {
2015-02-26 23:41:06 +01:00
public static final BlockStateEnum<BlockMinecartTrackAbstract.EnumTrackPosition> SHAPE = BlockStateEnum.a("shape", BlockMinecartTrackAbstract.EnumTrackPosition.class, new Predicate() {
2016-05-10 13:47:39 +02:00
@@ -117,6 +119,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);
2016-11-17 02:41:03 +01:00
world.applyPhysics(blockposition.down(), this, false);
2015-02-26 23:41:06 +01:00
if (((BlockMinecartTrackAbstract.EnumTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) {