Improve output to user in eta command

This commit is contained in:
scorbett123 2022-04-11 18:36:48 +01:00
parent dc6b32a154
commit 65974e15ba

View File

@ -28,6 +28,7 @@ import baritone.api.command.argument.IArgConsumer;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Stream; import java.util.stream.Stream;
public class ETACommand extends Command { public class ETACommand extends Command {
@ -45,12 +46,22 @@ public class ETACommand extends Command {
throw new CommandInvalidStateException("No process in control"); throw new CommandInvalidStateException("No process in control");
} }
IPathingBehavior pathingBehavior = baritone.getPathingBehavior(); IPathingBehavior pathingBehavior = baritone.getPathingBehavior();
logDirect(String.format(
"Next segment: %.2f\n" + Optional<Double> ticksRemainingInSegment = pathingBehavior.ticksRemainingInSegment();
"Goal: %.2f", Optional<Double> ticksRemainingInGoal = pathingBehavior.estimatedTicksToGoal();
pathingBehavior.ticksRemainingInSegment().orElse(-1.0),
pathingBehavior.estimatedTicksToGoal().orElse(-1.0) if (ticksRemainingInGoal.isPresent() && ticksRemainingInSegment.isPresent()) {
)); logDirect(String.format(
"Next segment: %.1fs (%.0f ticks)\n" +
"Goal: %.1fs (%.0f ticks)",
ticksRemainingInSegment.get() / 20, // we just assume tps is 20, it isn't worth the effort that is needed to calculate it exactly
ticksRemainingInSegment.get(),
ticksRemainingInGoal.get() / 20,
ticksRemainingInGoal.get()
));
} else {
logDirect("Not currently pathing");
}
} }
@Override @Override