Merge pull request #3388 from scorbett123/make_eta_show_ticks

Improve output to user in eta command
This commit is contained in:
Leijurv 2022-04-19 16:33:37 -07:00 committed by GitHub
commit cbef05838d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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,11 +46,17 @@ 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();
double ticksRemainingInSegment = pathingBehavior.ticksRemainingInSegment().orElse(Double.NaN);
double ticksRemainingInGoal = pathingBehavior.estimatedTicksToGoal().orElse(Double.NaN);
logDirect(String.format( logDirect(String.format(
"Next segment: %.2f\n" + "Next segment: %.1fs (%.0f ticks)\n" +
"Goal: %.2f", "Goal: %.1fs (%.0f ticks)",
pathingBehavior.ticksRemainingInSegment().orElse(-1.0), ticksRemainingInSegment / 20, // we just assume tps is 20, it isn't worth the effort that is needed to calculate it exactly
pathingBehavior.estimatedTicksToGoal().orElse(-1.0) ticksRemainingInSegment,
ticksRemainingInGoal / 20,
ticksRemainingInGoal
)); ));
} }