cache on load check

This commit is contained in:
Leijurv 2018-09-24 12:44:34 -07:00
parent 787665ae08
commit 9e27a59d7f
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -95,7 +95,9 @@ public class BlockStateInterface implements Helper {
if (prevChunk != null && prevChunk.x == x >> 4 && prevChunk.z == z >> 4) { if (prevChunk != null && prevChunk.x == x >> 4 && prevChunk.z == z >> 4) {
return true; 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; return true;
} }
CachedRegion prevRegion = prevCached; CachedRegion prevRegion = prevCached;
@ -106,11 +108,12 @@ public class BlockStateInterface implements Helper {
if (world == null) { if (world == null) {
return false; return false;
} }
CachedRegion region = world.cache.getRegion(x >> 9, z >> 9); prevRegion = world.cache.getRegion(x >> 9, z >> 9);
if (region == null) { if (prevRegion == null) {
return false; return false;
} }
return region.isCached(x & 511, z & 511); prevCached = prevRegion;
return prevRegion.isCached(x & 511, z & 511);
} }
public static void clearCachedChunk() { public static void clearCachedChunk() {