3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 14:50:08 +01:00
Paper/nms-patches/BlockPoweredRail.patch

26 Zeilen
1.4 KiB
Diff

--- ../work/decompile-8eb82bde//net/minecraft/server/BlockPoweredRail.java 2014-11-28 17:43:42.937707439 +0000
+++ src/main/java/net/minecraft/server/BlockPoweredRail.java 2014-11-28 17:38:19.000000000 +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 SHAPE = BlockStateEnum.a("shape", EnumTrackPosition.class, (Predicate) (new BlockPoweredRailInnerClass1()));
@@ -108,6 +110,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 (((EnumTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) {