From 2cf973809a2fc277c8a8507565131d49e3e11e6b Mon Sep 17 00:00:00 2001 From: scorbett123 <50634068+scorbett123@users.noreply.github.com> Date: Tue, 12 Apr 2022 12:15:42 +0100 Subject: [PATCH] eta command should default to NaN not just not showing the eta as suggested by ZacSharp --- .../baritone/command/defaults/ETACommand.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/baritone/command/defaults/ETACommand.java b/src/main/java/baritone/command/defaults/ETACommand.java index 6905610f..47b6ae9f 100644 --- a/src/main/java/baritone/command/defaults/ETACommand.java +++ b/src/main/java/baritone/command/defaults/ETACommand.java @@ -47,21 +47,17 @@ public class ETACommand extends Command { } IPathingBehavior pathingBehavior = baritone.getPathingBehavior(); - Optional ticksRemainingInSegment = pathingBehavior.ticksRemainingInSegment(); - Optional ticksRemainingInGoal = pathingBehavior.estimatedTicksToGoal(); + double ticksRemainingInSegment = pathingBehavior.ticksRemainingInSegment().orElse(Double.NaN); + double ticksRemainingInGoal = pathingBehavior.estimatedTicksToGoal().orElse(Double.NaN); - 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"); - } + logDirect(String.format( + "Next segment: %.1fs (%.0f ticks)\n" + + "Goal: %.1fs (%.0f ticks)", + ticksRemainingInSegment / 20, // we just assume tps is 20, it isn't worth the effort that is needed to calculate it exactly + ticksRemainingInSegment, + ticksRemainingInGoal / 20, + ticksRemainingInGoal + )); } @Override