From e05010c9d2454ca66137745f92cebcdb4a366119 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 1 May 2019 23:07:20 -0700 Subject: [PATCH] fix weird oscillation when mining large veins --- src/main/java/baritone/process/MineProcess.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index 72abfe9d..e8368d87 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -206,9 +206,16 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro knownOreLocations = locs; } - private static boolean internalMiningGoal(BlockPos pos, IPlayerContext ctx, List locs) { + private boolean internalMiningGoal(BlockPos pos, IPlayerContext ctx, List locs) { // Here, BlockStateInterface is used because the position may be in a cached chunk (the targeted block is one that is kept track of) - return locs.contains(pos) || (Baritone.settings().internalMiningAirException.value && BlockStateInterface.getBlock(ctx, pos) instanceof BlockAir); + if (locs.contains(pos)) { + return true; + } + Block block = BlockStateInterface.getBlock(ctx, pos); + if (Baritone.settings().internalMiningAirException.value && block instanceof BlockAir) { + return true; + } + return mining.contains(block); } private Goal coalesce(BlockPos loc, List locs) { @@ -363,7 +370,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro .filter(pos -> !blacklist.contains(pos)) - .sorted(Comparator.comparingDouble(ctx.getBaritone().getPlayerContext().playerFeet()::distanceSq)) + .sorted(Comparator.comparingDouble(ctx.getBaritone().getPlayerContext().player()::getDistanceSq)) .collect(Collectors.toList()); if (locs.size() > max) {