From 0fcff543522f612636bffe98a0eff9f469ece0a2 Mon Sep 17 00:00:00 2001 From: Mark Vainomaa Date: Fri, 17 Jan 2020 04:07:50 +0200 Subject: [PATCH] Fix dupe with Eigencraft redstone implementation (#2864) --- Spigot-Server-Patches/Optimize-redstone-algorithm.patch | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Spigot-Server-Patches/Optimize-redstone-algorithm.patch b/Spigot-Server-Patches/Optimize-redstone-algorithm.patch index 3c97e57230..2e8b86ce78 100644 --- a/Spigot-Server-Patches/Optimize-redstone-algorithm.patch +++ b/Spigot-Server-Patches/Optimize-redstone-algorithm.patch @@ -39,7 +39,7 @@ index dd5e263d7..357c7cf1d 100644 } diff --git a/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java new file mode 100644 -index 000000000..cf5661f1c +index 000000000..b69803cbf --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/RedstoneWireTurbo.java @@ -0,0 +0,0 @@ @@ -938,8 +938,11 @@ index 000000000..cf5661f1c + // and set it in the world. + // Possible optimization: Don't commit state changes to the world until they + // need to be known by some nearby non-redstone-wire block. -+ state = state.set(BlockRedstoneWire.POWER, Integer.valueOf(j)); -+ worldIn.setTypeAndData(upd.self, state, 2); ++ BlockPosition pos = new BlockPosition(upd.self.getX(), upd.self.getY(), upd.self.getZ()); ++ if (wire.canPlace(null, worldIn, pos)) { ++ state = state.set(BlockRedstoneWire.POWER, Integer.valueOf(j)); ++ worldIn.setTypeAndData(upd.self, state, 2); ++ } + } + + return state;