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; }