greatly increase mining visual scan range

This commit is contained in:
Leijurv 2018-11-20 16:32:44 -08:00
parent 033da7e737
commit 3bb16de67e
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -232,15 +232,16 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
public void addNearby() { public void addNearby() {
knownOreLocations.addAll(droppedItemsScan(mining, ctx.world())); knownOreLocations.addAll(droppedItemsScan(mining, ctx.world()));
BlockPos playerFeet = ctx.playerFeet(); BlockPos playerFeet = ctx.playerFeet();
int searchDist = 4; // why four? idk BlockStateInterface bsi = new BlockStateInterface(ctx);
int searchDist = 10;
double fakedBlockReachDistance = 20; // at least 10 * sqrt(3) with some extra space to account for positioning within the block
for (int x = playerFeet.getX() - searchDist; x <= playerFeet.getX() + searchDist; x++) { for (int x = playerFeet.getX() - searchDist; x <= playerFeet.getX() + searchDist; x++) {
for (int y = playerFeet.getY() - searchDist; y <= playerFeet.getY() + searchDist; y++) { for (int y = playerFeet.getY() - searchDist; y <= playerFeet.getY() + searchDist; y++) {
for (int z = playerFeet.getZ() - searchDist; z <= playerFeet.getZ() + searchDist; z++) { for (int z = playerFeet.getZ() - searchDist; z <= playerFeet.getZ() + searchDist; z++) {
BlockPos pos = new BlockPos(x, y, z);
// crucial to only add blocks we can see because otherwise this // crucial to only add blocks we can see because otherwise this
// is an x-ray and it'll get caught // is an x-ray and it'll get caught
if (mining.contains(BlockStateInterface.getBlock(ctx, pos)) && RotationUtils.reachable(ctx.player(), pos, ctx.playerController().getBlockReachDistance()).isPresent()) { if (mining.contains(bsi.get0(x, y, z).getBlock()) && RotationUtils.reachable(ctx.player(), new BlockPos(x, y, z), fakedBlockReachDistance).isPresent()) {
knownOreLocations.add(pos); knownOreLocations.add(new BlockPos(x, y, z));
} }
} }
} }