better behavior on arrival and failure

This commit is contained in:
Leijurv 2019-02-07 16:39:15 -08:00
parent 42513e4b56
commit 9a29f9ce57
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
1 changed files with 4 additions and 2 deletions

View File

@ -82,12 +82,13 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
} }
return new PathingCommand(null, PathingCommandType.CANCEL_AND_SET_GOAL); return new PathingCommand(null, PathingCommandType.CANCEL_AND_SET_GOAL);
} }
Goal goal = new GoalComposite(knownLocations.stream().map(this::createGoal).toArray(Goal[]::new));
if (calcFailed) { if (calcFailed) {
logDirect("Unable to find any path to " + gettingTo + ", canceling GetToBlock"); logDirect("Unable to find any path to " + gettingTo + ", canceling GetToBlock");
if (isSafeToCancel) { if (isSafeToCancel) {
onLostControl(); onLostControl();
} }
return new PathingCommand(null, PathingCommandType.CANCEL_AND_SET_GOAL); return new PathingCommand(goal, PathingCommandType.CANCEL_AND_SET_GOAL);
} }
int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.get(); int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.get();
if (mineGoalUpdateInterval != 0 && tickCount++ % mineGoalUpdateInterval == 0) { // big brain if (mineGoalUpdateInterval != 0 && tickCount++ % mineGoalUpdateInterval == 0) { // big brain
@ -95,15 +96,16 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
CalculationContext context = new CalculationContext(baritone, true); CalculationContext context = new CalculationContext(baritone, true);
Baritone.getExecutor().execute(() -> rescan(current, context)); Baritone.getExecutor().execute(() -> rescan(current, context));
} }
Goal goal = new GoalComposite(knownLocations.stream().map(this::createGoal).toArray(Goal[]::new));
if (goal.isInGoal(ctx.playerFeet()) && isSafeToCancel) { if (goal.isInGoal(ctx.playerFeet()) && isSafeToCancel) {
// we're there // we're there
if (rightClickOnArrival(gettingTo)) { if (rightClickOnArrival(gettingTo)) {
if (rightClick()) { if (rightClick()) {
onLostControl(); onLostControl();
return new PathingCommand(null, PathingCommandType.CANCEL_AND_SET_GOAL);
} }
} else { } else {
onLostControl(); onLostControl();
return new PathingCommand(null, PathingCommandType.CANCEL_AND_SET_GOAL);
} }
} }
return new PathingCommand(goal, PathingCommandType.REVALIDATE_GOAL_AND_PATH); return new PathingCommand(goal, PathingCommandType.REVALIDATE_GOAL_AND_PATH);