recalc if all points out of view

This commit is contained in:
Leijurv 2023-07-31 00:12:15 -07:00
parent 7662810405
commit 83feddf6be
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
1 changed files with 7 additions and 0 deletions

View File

@ -323,7 +323,11 @@ public final class ElytraBehavior implements Helper {
return;
}
boolean canSeeAny = false;
for (int i = rangeStartIncl; i < rangeEndExcl - 1; i++) {
if (ElytraBehavior.this.clearView(ctx.playerFeetAsVec(), this.path.getVec(i), false)) {
canSeeAny = true;
}
if (!ElytraBehavior.this.clearView(this.path.getVec(i), this.path.getVec(i + 1), false)) {
// obstacle. where do we return to pathing?
// find the next valid segment
@ -344,6 +348,9 @@ public final class ElytraBehavior implements Helper {
return;
}
}
if (!canSeeAny) {
this.pathRecalcSegment(rangeEndExcl - 1).thenRun(() -> logDirect("Recalculated segment since no path points were visible"));
}
}
private void attemptNextSegment() {