Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix redstone neighbor update order differing from vanilla #1866

Open
wants to merge 2 commits into
base: 1.21.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions patches/net/minecraft/world/level/Level.java.patch
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,16 @@

public void blockEntityChanged(BlockPos p_151544_) {
if (this.hasChunkAt(p_151544_)) {
@@ -935,16 +_,15 @@
@@ -934,17 +_,20 @@

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()) {
+ // Neo: Also send update to vertical directions
+ for (Direction direction : NEIGHBOR_UPDATE_LIST) {
BlockPos blockpos = p_46718_.relative(direction);
if (this.hasChunkAt(blockpos)) {
BlockState blockstate = this.getBlockState(blockpos);
Expand All @@ -193,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);
}
}
Expand Down
Loading