From 6be77867078a19e777ef5c885251e0be9b0e9b15 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 15 Aug 2018 17:29:45 -0700 Subject: [PATCH] ticks remaining in segment --- .../java/baritone/bot/behavior/impl/PathingBehavior.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java b/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java index 096daecf..0c27f8a2 100644 --- a/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java +++ b/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java @@ -122,7 +122,7 @@ public class PathingBehavior extends Behavior { // and this path dosen't get us all the way there return; } - if (current.getPath().ticksRemainingFrom(current.getPosition()) < Baritone.settings().planningTickLookAhead.get()) { + if (ticksRemainingInSegment().get() < Baritone.settings().planningTickLookAhead.get()) { // and this path has 5 seconds or less left displayChatMessageRaw("Path almost over. Planning ahead..."); findPathInNewThread(current.getPath().getDest(), false); @@ -131,6 +131,13 @@ public class PathingBehavior extends Behavior { } } + public Optional ticksRemainingInSegment() { + if (current == null) { + return Optional.empty(); + } + return Optional.of(current.getPath().ticksRemainingFrom(current.getPosition())); + } + public void setGoal(Goal goal) { this.goal = goal; }