use of baritone.api.cache.IWaypoint in project baritone by cabaletta.
the class FarmCommand method execute.
@Override
public void execute(String label, IArgConsumer args) throws CommandException {
args.requireMax(2);
int range = 0;
BetterBlockPos origin = null;
// range
if (args.has(1)) {
range = args.getAs(Integer.class);
}
// waypoint
if (args.has(1)) {
IWaypoint[] waypoints = args.getDatatypeFor(ForWaypoints.INSTANCE);
IWaypoint waypoint = null;
switch(waypoints.length) {
case 0:
throw new CommandInvalidStateException("No waypoints found");
case 1:
waypoint = waypoints[0];
break;
default:
throw new CommandInvalidStateException("Multiple waypoints were found");
}
origin = waypoint.getLocation();
}
baritone.getFarmProcess().farm(range, origin);
logDirect("Farming");
}
Aggregations