(CalculationContext ctx, BlockOptionalMetaLookup filter, int max, List<BlockPos> alreadyKnown, List<BlockPos> blacklist, List<BlockPos> dropped)
| 357 | } |
| 358 | |
| 359 | public static List<BlockPos> searchWorld(CalculationContext ctx, BlockOptionalMetaLookup filter, int max, List<BlockPos> alreadyKnown, List<BlockPos> blacklist, List<BlockPos> dropped) { |
| 360 | List<BlockPos> locs = new ArrayList<>(); |
| 361 | List<Block> untracked = new ArrayList<>(); |
| 362 | for (BlockOptionalMeta bom : filter.blocks()) { |
| 363 | Block block = bom.getBlock(); |
| 364 | if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(block)) { |
| 365 | BetterBlockPos pf = ctx.baritone.getPlayerContext().playerFeet(); |
| 366 | |
| 367 | // maxRegionDistanceSq 2 means adjacent directly or adjacent diagonally; nothing further than that |
| 368 | locs.addAll(ctx.worldData.getCachedWorld().getLocationsOf( |
| 369 | BlockUtils.blockToString(block), |
| 370 | Baritone.settings().maxCachedWorldScanCount.value, |
| 371 | pf.x, |
| 372 | pf.z, |
| 373 | 2 |
| 374 | )); |
| 375 | } else { |
| 376 | untracked.add(block); |
| 377 | } |
| 378 | } |
| 379 | |
| 380 | locs = prune(ctx, locs, filter, max, blacklist, dropped); |
| 381 | |
| 382 | if (!untracked.isEmpty() || (Baritone.settings().extendCacheOnThreshold.value && locs.size() < max)) { |
| 383 | locs.addAll(BaritoneAPI.getProvider().getWorldScanner().scanChunkRadius( |
| 384 | ctx.getBaritone().getPlayerContext(), |
| 385 | filter, |
| 386 | max, |
| 387 | 10, |
| 388 | 32 |
| 389 | )); // maxSearchRadius is NOT sq |
| 390 | } |
| 391 | |
| 392 | locs.addAll(alreadyKnown); |
| 393 | |
| 394 | return prune(ctx, locs, filter, max, blacklist, dropped); |
| 395 | } |
| 396 | |
| 397 | private boolean addNearby() { |
| 398 | List<BlockPos> dropped = droppedItemsScan(); |
no test coverage detected