make the ability to turn it off.

Signed-off-by: Sam Corbett <sam@corbettchocolates.com>
This commit is contained in:
Sam Corbett 2020-09-05 17:07:06 +01:00
parent 063f698bd2
commit 547db3a6b4
2 changed files with 9 additions and 8 deletions

View File

@ -734,7 +734,7 @@ public final class Settings {
/**
* When allowOnlyExposedOres is enabled this is the distance around to search.
* <p>
* I recommend keeping this value low as the amount of blocks that need to be scanned increases exponentially.
* It is recommended to keep this value low, as it exponentially increases calculation times and also to keep the
*/
public final Setting<Integer> allowOnlyExposedOresDistance = new Setting<>(1);

View File

@ -40,7 +40,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.math.Vec3d;
import java.util.*;
import java.util.stream.Collectors;
@ -410,7 +410,12 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
// remove any that are implausible to mine (encased in bedrock, or touching lava)
.filter(pos -> MineProcess.plausibleToBreak(ctx, pos))
.filter(pos -> isNextToAir(ctx, pos))
.filter(pos -> {
if (Baritone.settings().allowOnlyExposedOres.value)
return isNextToAir(ctx, pos);
else
return true;
})
.filter(pos -> !blacklist.contains(pos))
@ -494,7 +499,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
final double zn = nextZn;
nextZn = (z + 1) * invRadiusZ;
double distanceSq = lengthSq(xn, yn, zn);
double distanceSq = new Vec3d(xn, yn, zn).lengthSquared();
if (distanceSq > 1) {
if (z == 0) {
if (y == 0) {
@ -536,10 +541,6 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
return false;
}
private static double lengthSq(double x, double y, double z) {
return (x * x) + (y * y) + (z * z);
}
public static boolean isTransparent(BlockPos pos, CalculationContext ctx) {
IBlockState blockState = ctx.bsi.get0(pos);
return blockState.getBlock() == Blocks.AIR ||