From 2d969b55ef36ba2f98ffd18a2ff57730b9de2aa9 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 7 Sep 2018 18:23:05 -0700 Subject: [PATCH] fix world scanner radius --- src/main/java/baritone/chunk/WorldScanner.java | 12 ++++++------ .../baritone/utils/interfaces/IGoalRenderPos.java | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 src/main/java/baritone/utils/interfaces/IGoalRenderPos.java diff --git a/src/main/java/baritone/chunk/WorldScanner.java b/src/main/java/baritone/chunk/WorldScanner.java index 09edd1e5..27345670 100644 --- a/src/main/java/baritone/chunk/WorldScanner.java +++ b/src/main/java/baritone/chunk/WorldScanner.java @@ -47,13 +47,13 @@ public enum WorldScanner implements Helper { int playerChunkX = playerFeet().getX() >> 4; int playerChunkZ = playerFeet().getZ() >> 4; - int searchRadius = 2; + int searchRadiusSq = 0; while (true) { boolean allUnloaded = true; - for (int xoff = -searchRadius; xoff <= searchRadius; xoff++) { - for (int zoff = -searchRadius; zoff <= searchRadius; zoff++) { + for (int xoff = -searchRadiusSq; xoff <= searchRadiusSq; xoff++) { + for (int zoff = -searchRadiusSq; zoff <= searchRadiusSq; zoff++) { int distance = xoff * xoff + zoff * zoff; - if (distance != searchRadius) { + if (distance != searchRadiusSq) { continue; } int chunkX = xoff + playerChunkX; @@ -91,10 +91,10 @@ public enum WorldScanner implements Helper { if (allUnloaded) { return res; } - if (res.size() >= max) { + if (res.size() >= max && searchRadiusSq < 26) { return res; } - searchRadius++; + searchRadiusSq++; } } } diff --git a/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java b/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java new file mode 100644 index 00000000..cdc7cd00 --- /dev/null +++ b/src/main/java/baritone/utils/interfaces/IGoalRenderPos.java @@ -0,0 +1,4 @@ +package baritone.utils.interfaces; + +public class IGoalRenderPos { +}