fix off by one error (causing the last point to be stuck in terrain)

This commit is contained in:
Babbaj 2023-07-17 17:21:06 -04:00
parent dbc0a46b10
commit 4b5d629df6
No known key found for this signature in database
GPG Key ID: F044309848A07CAC
2 changed files with 4 additions and 3 deletions

View File

@ -175,8 +175,8 @@ dependencies {
transitive = false
}
launchAnnotationProcessor 'org.spongepowered:mixin:0.8.4-SNAPSHOT:processor'
launchImplementation('dev.babbaj:nether-pathfinder:0.34')
implementation 'dev.babbaj:nether-pathfinder:0.34'
launchImplementation('dev.babbaj:nether-pathfinder:0.39')
implementation 'dev.babbaj:nether-pathfinder:0.39'
testImplementation 'junit:junit:4.12'
}

View File

@ -195,7 +195,7 @@ public final class LegacyElytraBehavior implements Helper {
}
this.recalculating = true;
final List<BetterBlockPos> after = this.path.subList(upToIncl, this.path.size());
final List<BetterBlockPos> after = this.path.subList(upToIncl + 1, this.path.size());
final boolean complete = this.completePath;
return this.path0(ctx.playerFeet(), this.path.get(upToIncl), segment -> segment.append(after.stream(), complete))
@ -288,6 +288,7 @@ public final class LegacyElytraBehavior implements Helper {
while (rangeEndExcl < path.size() && ctx.world().isBlockLoaded(path.get(rangeEndExcl), false)) {
rangeEndExcl++;
}
// rangeEndExcl now represents an index either not in the path, or just outside render distance
if (rangeStartIncl >= rangeEndExcl) {
// not loaded yet?
return;