Search in sources :

Example 1 with GoalInverted

use of baritone.api.pathing.goals.GoalInverted in project Spark-Client by Spark-Client-Development.

the class InvertCommand method execute.

@Override
public void execute(String label, IArgConsumer args) throws CommandException {
    args.requireMax(0);
    ICustomGoalProcess customGoalProcess = baritone.getCustomGoalProcess();
    Goal goal;
    if ((goal = customGoalProcess.getGoal()) == null) {
        throw new CommandInvalidStateException("No goal");
    }
    if (goal instanceof GoalInverted) {
        goal = ((GoalInverted) goal).origin;
    } else {
        goal = new GoalInverted(goal);
    }
    customGoalProcess.setGoalAndPath(goal);
    logDirect(String.format("Goal: %s", goal.toString()));
}
Also used : Goal(baritone.api.pathing.goals.Goal) ICustomGoalProcess(baritone.api.process.ICustomGoalProcess) CommandInvalidStateException(baritone.api.command.exception.CommandInvalidStateException) GoalInverted(baritone.api.pathing.goals.GoalInverted)

Example 2 with GoalInverted

use of baritone.api.pathing.goals.GoalInverted in project baritone by cabaletta.

the class InvertCommand method execute.

@Override
public void execute(String label, IArgConsumer args) throws CommandException {
    args.requireMax(0);
    ICustomGoalProcess customGoalProcess = baritone.getCustomGoalProcess();
    Goal goal;
    if ((goal = customGoalProcess.getGoal()) == null) {
        throw new CommandInvalidStateException("No goal");
    }
    if (goal instanceof GoalInverted) {
        goal = ((GoalInverted) goal).origin;
    } else {
        goal = new GoalInverted(goal);
    }
    customGoalProcess.setGoalAndPath(goal);
    logDirect(String.format("Goal: %s", goal.toString()));
}
Also used : Goal(baritone.api.pathing.goals.Goal) ICustomGoalProcess(baritone.api.process.ICustomGoalProcess) CommandInvalidStateException(baritone.api.command.exception.CommandInvalidStateException) GoalInverted(baritone.api.pathing.goals.GoalInverted)

Aggregations

CommandInvalidStateException (baritone.api.command.exception.CommandInvalidStateException)2 Goal (baritone.api.pathing.goals.Goal)2 GoalInverted (baritone.api.pathing.goals.GoalInverted)2 ICustomGoalProcess (baritone.api.process.ICustomGoalProcess)2