get rid of negative ETAs the lazy way

This commit is contained in:
ZacSharp 2020-09-02 22:59:13 +02:00
parent 695954bdb0
commit 35f3be9296
No known key found for this signature in database
GPG Key ID: 9453647B005083A3

View File

@ -387,7 +387,11 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
if (current == start) {//can't check above because current and start can be equal even if currentPos and startPosition are not
return Optional.empty();
}
return Optional.of(current * ticksElapsedSoFar / (start - current));
double eta = current * ticksElapsedSoFar / (start - current);
if (eta < 0 || current < 0){
return Optional.empty();
}
return Optional.of(eta);
}
/**