use of baritone.pathing.movement.CalculationContext in project baritone by cabaletta.
the class MineProcess method prune.
private static List<BlockPos> prune(CalculationContext ctx, List<BlockPos> locs2, BlockOptionalMetaLookup filter, int max, List<BlockPos> blacklist, List<BlockPos> dropped) {
dropped.removeIf(drop -> {
for (BlockPos pos : locs2) {
if (pos.distanceSq(drop) <= 9 && filter.has(ctx.get(pos.getX(), pos.getY(), pos.getZ())) && MineProcess.plausibleToBreak(ctx, pos)) {
// TODO maybe drop also has to be supported? no lava below?
return true;
}
}
return false;
});
List<BlockPos> locs = locs2.stream().distinct().filter(pos -> !ctx.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ()) || filter.has(ctx.get(pos.getX(), pos.getY(), pos.getZ())) || dropped.contains(pos)).filter(pos -> MineProcess.plausibleToBreak(ctx, pos)).filter(pos -> {
if (Baritone.settings().allowOnlyExposedOres.value) {
return isNextToAir(ctx, pos);
} else {
return true;
}
}).filter(pos -> pos.getY() >= Baritone.settings().minYLevelWhileMining.value).filter(pos -> !blacklist.contains(pos)).sorted(Comparator.comparingDouble(ctx.getBaritone().getPlayerContext().player()::getDistanceSq)).collect(Collectors.toList());
if (locs.size() > max) {
return locs.subList(0, max);
}
return locs;
}
use of baritone.pathing.movement.CalculationContext in project baritone by cabaletta.
the class MineProcess method mine.
@Override
public void mine(int quantity, BlockOptionalMetaLookup filter) {
this.filter = filter;
if (filter != null && !Baritone.settings().allowBreak.value) {
logDirect("Unable to mine when allowBreak is false!");
this.mine(quantity, (BlockOptionalMetaLookup) null);
return;
}
this.desiredQuantity = quantity;
this.knownOreLocations = new ArrayList<>();
this.blacklist = new ArrayList<>();
this.branchPoint = null;
this.branchPointRunaway = null;
this.anticipatedDrops = new HashMap<>();
if (filter != null) {
rescan(new ArrayList<>(), new CalculationContext(baritone));
}
}
Aggregations