0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 10:06:16 +00:00
craftbukkit/nms-patches/net/minecraft/world/level/redstone/ExperimentalRedstoneWireEvaluator.patch
2024-10-23 02:15:00 +11:00

33 lines
1.4 KiB
Diff

--- a/net/minecraft/world/level/redstone/ExperimentalRedstoneWireEvaluator.java
+++ b/net/minecraft/world/level/redstone/ExperimentalRedstoneWireEvaluator.java
@@ -17,6 +17,11 @@
import net.minecraft.world.level.block.state.properties.BlockPropertyRedstoneSide;
import net.minecraft.world.level.block.state.properties.BlockStateEnum;
+// CraftBukkit start
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.event.block.BlockRedstoneEvent;
+// CraftBukkit end
+
public class ExperimentalRedstoneWireEvaluator extends RedstoneWireEvaluator {
private final Deque<BlockPosition> wiresToTurnOff = new ArrayDeque();
@@ -41,7 +46,16 @@
int j = unpackPower(i);
IBlockData iblockdata1 = world.getBlockState(blockposition1);
- if (iblockdata1.is((Block) this.wireBlock) && !((Integer) iblockdata1.getValue(BlockRedstoneWire.POWER)).equals(j)) {
+ // CraftBukkit start
+ int oldPower = iblockdata.getValue(BlockRedstoneWire.POWER);
+ if (oldPower != j) {
+ BlockRedstoneEvent event = new BlockRedstoneEvent(CraftBlock.at(world, blockposition1), oldPower, j);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ j = event.getNewCurrent();
+ }
+ if (iblockdata1.is((Block) this.wireBlock) && oldPower != j) {
+ // CraftBukkit end
int k = 2;
if (!flag || !flag1) {