Skip to content

Commit

Permalink
refact: now bit shifting instead of masking
Browse files Browse the repository at this point in the history
  • Loading branch information
Metaphoriker committed Oct 7, 2024
1 parent 5595c66 commit d133392
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ public PathBlock getHighestBlockAt(PathPosition position) {
if (chunkSnapshotOptional.isPresent()) {
ChunkSnapshot chunkSnapshot = chunkSnapshotOptional.get();

int chunkX = position.getBlockX() & 0xF;
int chunkZ = position.getBlockZ() & 0xF;
int chunkX = position.getBlockX() >> 4;
int chunkZ = position.getBlockZ() >> 4;

for (int y = chunkSnapshot.getHighestBlockYAt(chunkX, chunkZ);
y >= position.getPathEnvironment().getMinHeight();
Expand Down Expand Up @@ -219,8 +219,8 @@ public PathBlock getHighestBlockAt(@NonNull PathPosition position) {
private PathBlock ensureHighestBlock(PathPosition pathPosition) {
ChunkSnapshot chunkSnapshot = retrieveSnapshot(pathPosition);

int chunkX = pathPosition.getBlockX() & 0xF;
int chunkZ = pathPosition.getBlockZ() & 0xF;
int chunkX = pathPosition.getBlockX() >> 4;
int chunkZ = pathPosition.getBlockZ() >> 4;

int minY = pathPosition.getPathEnvironment().getMinHeight();
for (int y = chunkSnapshot.getHighestBlockYAt(chunkX, chunkZ); y >= minY; y--) {
Expand Down

0 comments on commit d133392

Please sign in to comment.