greatly increase mining visual scan range
This commit is contained in:
parent
033da7e737
commit
3bb16de67e
@ -205,7 +205,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
|||||||
/*public static List<BlockPos> searchWorld(List<Block> mining, int max, World world) {
|
/*public static List<BlockPos> searchWorld(List<Block> mining, int max, World world) {
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
public static List<BlockPos> searchWorld(IPlayerContext ctx, List<Block> mining, int max, List<BlockPos> alreadyKnown) {
|
public static List<BlockPos> searchWorld(IPlayerContext ctx, List<Block> mining, int max, List<BlockPos> alreadyKnown) {
|
||||||
List<BlockPos> locs = new ArrayList<>();
|
List<BlockPos> locs = new ArrayList<>();
|
||||||
List<Block> uninteresting = new ArrayList<>();
|
List<Block> uninteresting = new ArrayList<>();
|
||||||
//long b = System.currentTimeMillis();
|
//long b = System.currentTimeMillis();
|
||||||
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user