From 89b333faf9ea32a4ca1263543289869cfefcd1b5 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Fri, 17 Jan 2025 21:27:25 -0500 Subject: [PATCH 1/2] Fix redstone neighbor update order differing from vanilla --- patches/net/minecraft/world/level/Level.java.patch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/patches/net/minecraft/world/level/Level.java.patch b/patches/net/minecraft/world/level/Level.java.patch index fa99b6ae50..5cfb8bef19 100644 --- a/patches/net/minecraft/world/level/Level.java.patch +++ b/patches/net/minecraft/world/level/Level.java.patch @@ -176,12 +176,15 @@ public void blockEntityChanged(BlockPos p_151544_) { if (this.hasChunkAt(p_151544_)) { -@@ -935,16 +_,15 @@ +@@ -934,17 +_,18 @@ + public abstract Scoreboard getScoreboard(); ++ private static final Direction[] NEIGHBOR_UPDATE_LIST = java.util.stream.Stream.concat(Direction.Plane.HORIZONTAL.stream(), Direction.Plane.VERTICAL.stream()).toArray(Direction[]::new); ++ public void updateNeighbourForOutputSignal(BlockPos p_46718_, Block p_46719_) { - for (Direction direction : Direction.Plane.HORIZONTAL) { -+ for(Direction direction : Direction.values()) { ++ for (Direction direction : NEIGHBOR_UPDATE_LIST) { BlockPos blockpos = p_46718_.relative(direction); if (this.hasChunkAt(blockpos)) { BlockState blockstate = this.getBlockState(blockpos); From a24773c091c0641cbfdf204b29ae3e38d8511475 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Sat, 18 Jan 2025 10:18:39 -0500 Subject: [PATCH 2/2] Address feedback --- patches/net/minecraft/world/level/Level.java.patch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/net/minecraft/world/level/Level.java.patch b/patches/net/minecraft/world/level/Level.java.patch index 5cfb8bef19..e43dbdb9d0 100644 --- a/patches/net/minecraft/world/level/Level.java.patch +++ b/patches/net/minecraft/world/level/Level.java.patch @@ -176,7 +176,7 @@ public void blockEntityChanged(BlockPos p_151544_) { if (this.hasChunkAt(p_151544_)) { -@@ -934,17 +_,18 @@ +@@ -934,17 +_,20 @@ public abstract Scoreboard getScoreboard(); @@ -184,6 +184,7 @@ + public void updateNeighbourForOutputSignal(BlockPos p_46718_, Block p_46719_) { - for (Direction direction : Direction.Plane.HORIZONTAL) { ++ // Neo: Also send update to vertical directions + for (Direction direction : NEIGHBOR_UPDATE_LIST) { BlockPos blockpos = p_46718_.relative(direction); if (this.hasChunkAt(blockpos)) { @@ -196,7 +197,8 @@ blockpos = blockpos.relative(direction); blockstate = this.getBlockState(blockpos); - if (blockstate.is(Blocks.COMPARATOR)) { -+ if (blockstate.getWeakChanges(this, blockpos)) { ++ // Neo: send to any blockstate that wants weak changes, but exclude vanilla comparators from vertical updates ++ if (blockstate.getWeakChanges(this, blockpos) && (direction.getAxis().isHorizontal() || !blockstate.is(Blocks.COMPARATOR))) { this.neighborChanged(blockstate, blockpos, p_46719_, null, false); } }