From d0fd370d53b11af181742ecf8d22d8300d4b9d04 Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 20 Sep 2018 11:35:36 -0500 Subject: [PATCH] Fix issue with WorldScanner where no chunks match exact dist squared --- src/main/java/baritone/cache/WorldScanner.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index bd2690a6..db457744 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -50,12 +50,14 @@ public enum WorldScanner implements Helper { boolean foundWithinY = false; while (true) { boolean allUnloaded = true; + boolean foundChunks = false; for (int xoff = -searchRadiusSq; xoff <= searchRadiusSq; xoff++) { for (int zoff = -searchRadiusSq; zoff <= searchRadiusSq; zoff++) { int distance = xoff * xoff + zoff * zoff; if (distance != searchRadiusSq) { continue; } + foundChunks = true; int chunkX = xoff + playerChunkX; int chunkZ = zoff + playerChunkZ; Chunk chunk = chunkProvider.getLoadedChunk(chunkX, chunkZ); @@ -92,7 +94,7 @@ public enum WorldScanner implements Helper { } } } - if (allUnloaded) { + if (allUnloaded && foundChunks) { return res; } if (res.size() >= max && (searchRadiusSq > 26 || (searchRadiusSq > 1 && foundWithinY))) {