aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PoweredRailBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PoweredRailBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PoweredRailBlock.java.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PoweredRailBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PoweredRailBlock.java.patch
new file mode 100644
index 0000000000..3649b9bccc
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/PoweredRailBlock.java.patch
@@ -0,0 +1,33 @@
+--- a/net/minecraft/world/level/block/PoweredRailBlock.java
++++ b/net/minecraft/world/level/block/PoweredRailBlock.java
+@@ -11,6 +11,7 @@
+ import net.minecraft.world.level.block.state.properties.EnumProperty;
+ import net.minecraft.world.level.block.state.properties.Property;
+ import net.minecraft.world.level.block.state.properties.RailShape;
++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
+ public class PoweredRailBlock extends BaseRailBlock {
+
+@@ -122,11 +121,18 @@
+ boolean flag1 = level.hasNeighborSignal(blockpos) || this.findPoweredRailSignal(level, blockpos, blockstate, true, 0) || this.findPoweredRailSignal(level, blockpos, blockstate, false, 0);
+
+ if (flag1 != flag) {
+- level.setBlock(blockpos, (BlockState) blockstate.setValue(PoweredRailBlock.POWERED, flag1), 3);
+- level.updateNeighborsAt(blockpos.below(), this);
+- if (((RailShape) blockstate.getValue(PoweredRailBlock.SHAPE)).isAscending()) {
+- level.updateNeighborsAt(blockpos.above(), this);
++ // CraftBukkit start
++ int power = flag ? 15 : 0;
++ int newPower = CraftEventFactory.callRedstoneChange(level, pos, power, 15 - power).getNewCurrent();
++ if (newPower == power) {
++ return;
+ }
++ // CraftBukkit end
++ level.setBlock(pos, (IBlockData) state.setValue(PoweredRailBlock.POWERED, flag1), 3);
++ level.updateNeighborsAt(pos.below(), this);
++ if (((RailShape) state.getValue(PoweredRailBlock.SHAPE)).isAscending()) {
++ level.updateNeighborsAt(pos.above(), this);
++ }
+ }
+
+ }