Skip to content

Commit

Permalink
Fix redstone wire connection logic not matching Java
Browse files Browse the repository at this point in the history
  • Loading branch information
HiveGames-OSS committed Dec 18, 2024
1 parent 8954ff0 commit 8302ac7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@ public ChunkerBlockIdentifier handle(ChunkerColumn column, Map<Edge, ChunkerColu
blockIdentifier = blockIdentifier.copyWith(state, redstoneConnection);
}

// Get the states which were applied
boolean north = blockIdentifier.getState(VanillaBlockStates.REDSTONE_NORTH) != RedstoneConnection.NONE;
boolean east = blockIdentifier.getState(VanillaBlockStates.REDSTONE_EAST) != RedstoneConnection.NONE;
boolean south = blockIdentifier.getState(VanillaBlockStates.REDSTONE_SOUTH) != RedstoneConnection.NONE;
boolean west = blockIdentifier.getState(VanillaBlockStates.REDSTONE_WEST) != RedstoneConnection.NONE;
boolean northSouthNone = !north && !south;
boolean eastWestNone = !east && !west;

// Apply any additional connections (based on Java edition logic)
if (!north && eastWestNone) {
blockIdentifier = blockIdentifier.copyWith(VanillaBlockStates.REDSTONE_NORTH, RedstoneConnection.SIDE);
}
if (!east && northSouthNone) {
blockIdentifier = blockIdentifier.copyWith(VanillaBlockStates.REDSTONE_EAST, RedstoneConnection.SIDE);
}
if (!south && eastWestNone) {
blockIdentifier = blockIdentifier.copyWith(VanillaBlockStates.REDSTONE_SOUTH, RedstoneConnection.SIDE);
}
if (!west && northSouthNone) {
blockIdentifier = blockIdentifier.copyWith(VanillaBlockStates.REDSTONE_WEST, RedstoneConnection.SIDE);
}

// Return the block identifier to be updated
return blockIdentifier;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,28 @@ public ChunkerBlockIdentifier handle(ChunkerColumn column, Map<Edge, ChunkerColu
blockIdentifier = blockIdentifier.copyWith(state, redstoneConnection);
}

// Get the states which were applied
boolean north = blockIdentifier.getState(VanillaBlockStates.REDSTONE_NORTH) != RedstoneConnection.NONE;
boolean east = blockIdentifier.getState(VanillaBlockStates.REDSTONE_EAST) != RedstoneConnection.NONE;
boolean south = blockIdentifier.getState(VanillaBlockStates.REDSTONE_SOUTH) != RedstoneConnection.NONE;
boolean west = blockIdentifier.getState(VanillaBlockStates.REDSTONE_WEST) != RedstoneConnection.NONE;
boolean northSouthNone = !north && !south;
boolean eastWestNone = !east && !west;

// Apply any additional connections (based on Java edition logic)
if (!north && eastWestNone) {
blockIdentifier = blockIdentifier.copyWith(VanillaBlockStates.REDSTONE_NORTH, RedstoneConnection.SIDE);
}
if (!east && northSouthNone) {
blockIdentifier = blockIdentifier.copyWith(VanillaBlockStates.REDSTONE_EAST, RedstoneConnection.SIDE);
}
if (!south && eastWestNone) {
blockIdentifier = blockIdentifier.copyWith(VanillaBlockStates.REDSTONE_SOUTH, RedstoneConnection.SIDE);
}
if (!west && northSouthNone) {
blockIdentifier = blockIdentifier.copyWith(VanillaBlockStates.REDSTONE_WEST, RedstoneConnection.SIDE);
}

// Return the block identifier to be updated
return blockIdentifier;
}
Expand Down

0 comments on commit 8302ac7

Please sign in to comment.