From 65974e15ba5efc0ea8d7a5b2388b5ca77dfd3a5a Mon Sep 17 00:00:00 2001 From: scorbett123 <50634068+scorbett123@users.noreply.github.com> Date: Mon, 11 Apr 2022 18:36:48 +0100 Subject: [PATCH 1/2] Improve output to user in eta command --- .../baritone/command/defaults/ETACommand.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/baritone/command/defaults/ETACommand.java b/src/main/java/baritone/command/defaults/ETACommand.java index 3c16bd11..6905610f 100644 --- a/src/main/java/baritone/command/defaults/ETACommand.java +++ b/src/main/java/baritone/command/defaults/ETACommand.java @@ -28,6 +28,7 @@ import baritone.api.command.argument.IArgConsumer; import java.util.Arrays; import java.util.List; +import java.util.Optional; import java.util.stream.Stream; public class ETACommand extends Command { @@ -45,12 +46,22 @@ public class ETACommand extends Command { throw new CommandInvalidStateException("No process in control"); } IPathingBehavior pathingBehavior = baritone.getPathingBehavior(); - logDirect(String.format( - "Next segment: %.2f\n" + - "Goal: %.2f", - pathingBehavior.ticksRemainingInSegment().orElse(-1.0), - pathingBehavior.estimatedTicksToGoal().orElse(-1.0) - )); + + Optional ticksRemainingInSegment = pathingBehavior.ticksRemainingInSegment(); + Optional ticksRemainingInGoal = pathingBehavior.estimatedTicksToGoal(); + + 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 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 2/2] 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