🐛Reset ETA and return 0 if we are already there

not doing this caused a continuously increasing ETA when standing inside a `GoalNear` from `FollowProcess`
This commit is contained in:
ZacSharp 2020-09-18 23:24:47 +02:00
parent 411b2a0acc
commit 46a12754e9
No known key found for this signature in database
GPG Key ID: 9453647B005083A3

View File

@ -378,7 +378,14 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
} }
public Optional<Double> estimatedTicksToGoal() { public Optional<Double> estimatedTicksToGoal() {
if (goal == null || ticksElapsedSoFar == 0) { if (goal == null) {
return Optional.empty();
}
if (goal.isInGoal(ctx.playerFeet())) {
resetEstimatedTicksToGoal();
return Optional.of(0.0);
}
if (ticksElapsedSoFar == 0) {
return Optional.empty(); return Optional.empty();
} }
BetterBlockPos currentPos = ctx.playerFeet(); BetterBlockPos currentPos = ctx.playerFeet();