mirror of
https://github.com/cabaletta/baritone
synced 2024-12-26 17:02:24 +00:00
don't scan empty
This commit is contained in:
parent
7cc23bc89b
commit
4f07d655d6
@ -70,6 +70,7 @@ public class MineBehavior extends Behavior {
|
||||
public static List<BlockPos> scanFor(List<String> mining, int max) {
|
||||
List<BlockPos> locs = new ArrayList<>();
|
||||
List<String> 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));
|
||||
|
||||
|
@ -39,6 +39,9 @@ public enum WorldScanner implements Helper {
|
||||
throw new IllegalStateException("Invalid block name should have been caught earlier: " + blockTypes.toString());
|
||||
}
|
||||
LinkedList<BlockPos> res = new LinkedList<>();
|
||||
if (asBlocks.isEmpty()) {
|
||||
return res;
|
||||
}
|
||||
ChunkProviderClient chunkProvider = world().getChunkProvider();
|
||||
|
||||
int playerChunkX = playerFeet().getX() >> 4;
|
||||
|
Loading…
Reference in New Issue
Block a user