From f047dd08b0b710b4ad1e1e05dc1e57badde46949 Mon Sep 17 00:00:00 2001 From: Brady Date: Tue, 7 Aug 2018 00:48:02 -0500 Subject: [PATCH] Fix bad block lookups with cached chunks --- src/main/java/baritone/bot/chunk/CachedRegion.java | 2 +- src/main/java/baritone/bot/chunk/CachedWorld.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/bot/chunk/CachedRegion.java b/src/main/java/baritone/bot/chunk/CachedRegion.java index 39c6c128..b0362ca2 100644 --- a/src/main/java/baritone/bot/chunk/CachedRegion.java +++ b/src/main/java/baritone/bot/chunk/CachedRegion.java @@ -43,7 +43,7 @@ public final class CachedRegion implements ICachedChunkAccess { public final PathingBlockType getBlockType(int x, int y, int z) { CachedChunk chunk = this.getChunk(x >> 4, z >> 4); if (chunk != null) { - return chunk.getBlockType(x, y, z); + return chunk.getBlockType(x & 15, y, z & 15); } return null; } diff --git a/src/main/java/baritone/bot/chunk/CachedWorld.java b/src/main/java/baritone/bot/chunk/CachedWorld.java index 35aad603..24bea82a 100644 --- a/src/main/java/baritone/bot/chunk/CachedWorld.java +++ b/src/main/java/baritone/bot/chunk/CachedWorld.java @@ -37,7 +37,7 @@ public final class CachedWorld implements ICachedChunkAccess { public final PathingBlockType getBlockType(int x, int y, int z) { CachedRegion region = getRegion(x >> 9, z >> 9); if (region != null) { - return region.getBlockType(x, y, z); + return region.getBlockType(x & 511, y, z & 511); } return null; }