From 7d94cb259fc7e19b487d390c7f72bc316159d649 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 14 Sep 2018 12:24:53 -0700 Subject: [PATCH] world scanner do 1 chunk only if blocks at same y have been found --- src/main/java/baritone/cache/WorldScanner.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index 975683d1..76118093 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -44,8 +44,10 @@ public enum WorldScanner implements Helper { int playerChunkX = playerFeet().getX() >> 4; int playerChunkZ = playerFeet().getZ() >> 4; + int playerY = playerFeet().getY(); int searchRadiusSq = 0; + boolean foundWithinY = false; while (true) { boolean allUnloaded = true; for (int xoff = -searchRadiusSq; xoff <= searchRadiusSq; xoff++) { @@ -78,7 +80,11 @@ public enum WorldScanner implements Helper { for (int x = 0; x < 16; x++) { IBlockState state = bsc.get(x, y, z); if (blocks.contains(state.getBlock())) { - res.add(new BlockPos(chunkX | x, yReal | y, chunkZ | z)); + int yy = yReal | y; + res.add(new BlockPos(chunkX | x, yy, chunkZ | z)); + if (Math.abs(yy - playerY) < 10) { + foundWithinY = true; + } } } } @@ -89,7 +95,7 @@ public enum WorldScanner implements Helper { if (allUnloaded) { return res; } - if (res.size() >= max && searchRadiusSq > 26) { + if (res.size() >= max && (searchRadiusSq > 26 || (searchRadiusSq > 1 && foundWithinY))) { return res; } searchRadiusSq++;