MCPcopy Create free account
hub / github.com/cabaletta/baritone / searchWorld

Method searchWorld

src/main/java/baritone/process/MineProcess.java:359–395  ·  view source on GitHub ↗
(CalculationContext ctx, BlockOptionalMetaLookup filter, int max, List<BlockPos> alreadyKnown, List<BlockPos> blacklist, List<BlockPos> dropped)

Source from the content-addressed store, hash-verified

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();

Callers 2

rescanMethod · 0.95
rescanMethod · 0.95

Calls 15

blockToStringMethod · 0.95
settingsMethod · 0.95
pruneMethod · 0.95
getProviderMethod · 0.95
blocksMethod · 0.80
playerFeetMethod · 0.80
addMethod · 0.80
getBlockMethod · 0.65
getPlayerContextMethod · 0.65
getLocationsOfMethod · 0.65
getCachedWorldMethod · 0.65
isEmptyMethod · 0.65

Tested by

no test coverage detected