()
| 395 | } |
| 396 | |
| 397 | private boolean addNearby() { |
| 398 | List<BlockPos> dropped = droppedItemsScan(); |
| 399 | knownOreLocations.addAll(dropped); |
| 400 | BlockPos playerFeet = ctx.playerFeet(); |
| 401 | BlockStateInterface bsi = new BlockStateInterface(ctx); |
| 402 | |
| 403 | |
| 404 | BlockOptionalMetaLookup filter = filterFilter(); |
| 405 | if (filter == null) { |
| 406 | return false; |
| 407 | } |
| 408 | |
| 409 | int searchDist = 10; |
| 410 | double fakedBlockReachDistance = 20; // at least 10 * sqrt(3) with some extra space to account for positioning within the block |
| 411 | for (int x = playerFeet.getX() - searchDist; x <= playerFeet.getX() + searchDist; x++) { |
| 412 | for (int y = playerFeet.getY() - searchDist; y <= playerFeet.getY() + searchDist; y++) { |
| 413 | for (int z = playerFeet.getZ() - searchDist; z <= playerFeet.getZ() + searchDist; z++) { |
| 414 | // crucial to only add blocks we can see because otherwise this |
| 415 | // is an x-ray and it'll get caught |
| 416 | if (filter.has(bsi.get0(x, y, z))) { |
| 417 | BlockPos pos = new BlockPos(x, y, z); |
| 418 | if ((Baritone.settings().legitMineIncludeDiagonals.value && knownOreLocations.stream().anyMatch(ore -> ore.distSqr(pos) <= 2 /* sq means this is pytha dist <= sqrt(2) */)) || RotationUtils.reachable(ctx, pos, fakedBlockReachDistance).isPresent()) { |
| 419 | knownOreLocations.add(pos); |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | } |
| 424 | } |
| 425 | knownOreLocations = prune(new CalculationContext(baritone), knownOreLocations, filter, Baritone.settings().mineMaxOreLocationsCount.value, blacklist, dropped); |
| 426 | return true; |
| 427 | } |
| 428 | |
| 429 | private static List<BlockPos> prune(CalculationContext ctx, List<BlockPos> locs2, BlockOptionalMetaLookup filter, int max, List<BlockPos> blacklist, List<BlockPos> dropped) { |
| 430 | dropped.removeIf(drop -> { |
no test coverage detected