diff --git a/src/main/java/baritone/behavior/impl/MineBehavior.java b/src/main/java/baritone/behavior/impl/MineBehavior.java index bbd1c594..d4b09b7b 100644 --- a/src/main/java/baritone/behavior/impl/MineBehavior.java +++ b/src/main/java/baritone/behavior/impl/MineBehavior.java @@ -70,6 +70,7 @@ public class MineBehavior extends Behavior { public static List scanFor(List mining, int max) { List locs = new ArrayList<>(); List uninteresting = new ArrayList<>(); + //long b = System.currentTimeMillis(); for (String m : mining) { if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(ChunkPacker.stringToBlock(m))) { locs.addAll(WorldProvider.INSTANCE.getCurrentWorld().cache.getLocationsOf(m, 1, 1)); @@ -77,7 +78,12 @@ public class MineBehavior extends Behavior { uninteresting.add(m); } } - locs.addAll(WorldScanner.INSTANCE.scanLoadedChunks(uninteresting, max)); + //System.out.println("Scan of cached chunks took " + (System.currentTimeMillis() - b) + "ms"); + if (!uninteresting.isEmpty()) { + //long before = System.currentTimeMillis(); + locs.addAll(WorldScanner.INSTANCE.scanLoadedChunks(uninteresting, max)); + //System.out.println("Scan of loaded chunks took " + (System.currentTimeMillis() - before) + "ms"); + } BlockPos playerFeet = MineBehavior.INSTANCE.playerFeet(); locs.sort(Comparator.comparingDouble(playerFeet::distanceSq)); diff --git a/src/main/java/baritone/chunk/WorldScanner.java b/src/main/java/baritone/chunk/WorldScanner.java index 62e20944..fe3c0ea5 100644 --- a/src/main/java/baritone/chunk/WorldScanner.java +++ b/src/main/java/baritone/chunk/WorldScanner.java @@ -39,6 +39,9 @@ public enum WorldScanner implements Helper { throw new IllegalStateException("Invalid block name should have been caught earlier: " + blockTypes.toString()); } LinkedList res = new LinkedList<>(); + if (asBlocks.isEmpty()) { + return res; + } ChunkProviderClient chunkProvider = world().getChunkProvider(); int playerChunkX = playerFeet().getX() >> 4;