From 9e27a59d7f576e459e91d506bcd705dfaf3519c0 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 24 Sep 2018 12:44:34 -0700 Subject: [PATCH] cache on load check --- src/main/java/baritone/utils/BlockStateInterface.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/utils/BlockStateInterface.java b/src/main/java/baritone/utils/BlockStateInterface.java index fda465f4..068721cd 100644 --- a/src/main/java/baritone/utils/BlockStateInterface.java +++ b/src/main/java/baritone/utils/BlockStateInterface.java @@ -95,7 +95,9 @@ public class BlockStateInterface implements Helper { if (prevChunk != null && prevChunk.x == x >> 4 && prevChunk.z == z >> 4) { return true; } - if (mc.world.getChunk(x >> 4, z >> 4).isLoaded()) { + prevChunk = mc.world.getChunk(x >> 4, z >> 4); + if (prevChunk.isLoaded()) { + prev = prevChunk; return true; } CachedRegion prevRegion = prevCached; @@ -106,11 +108,12 @@ public class BlockStateInterface implements Helper { if (world == null) { return false; } - CachedRegion region = world.cache.getRegion(x >> 9, z >> 9); - if (region == null) { + prevRegion = world.cache.getRegion(x >> 9, z >> 9); + if (prevRegion == null) { return false; } - return region.isCached(x & 511, z & 511); + prevCached = prevRegion; + return prevRegion.isCached(x & 511, z & 511); } public static void clearCachedChunk() {