Skip to content

Commit beb9ed4

Browse files
committed
only start pathing when on ground to prevent flying too far after jumping and check progression to see if stuck
1 parent cdf7d39 commit beb9ed4

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • src/main/kotlin/com/lambda/module/modules/movement

src/main/kotlin/com/lambda/module/modules/movement/ElytraFly.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,20 @@ object ElytraFly : Module(
219219
if (passObstacles && validDistanceFromStart) run obstacleChecks@{
220220
val snappedDir = getSnappedDir()
221221
val closestLinePoint = playerPos.findClosestPointOnLine(snappedDir)
222+
222223
passingToPos?.let { passingTo ->
223224
if (passingTo.isObstructed(snappedDir)) {
224225
pathToValidPoint(passingTo, snappedDir)
225226
}
226227
return
227228
}
229+
230+
val notProgressing = Speedometer.calculateSpeed(true, SpeedUnit.BlocksPerSecond) < 0.01
231+
if (player.isGliding && notProgressing) {
232+
pathToValidPoint(closestLinePoint, snappedDir)
233+
return
234+
}
235+
228236
// We only want to account for horizontal and below the line rather than total
229237
// distance as jumping from bounce might cause false positives
230238
val distanceToLine =
@@ -276,6 +284,7 @@ object ElytraFly : Module(
276284

277285
context(safeContext: SafeContext)
278286
private fun pathToValidPoint(startSearchPos: Vec3d, dir: Vec3d, initialBlockedCheck: Boolean = false) {
287+
if (!safeContext.player.isOnGround) return
279288
var skippingFirstCheck = !initialBlockedCheck
280289
var searchPos = startSearchPos
281290
while (skippingFirstCheck || searchPos.isObstructed(dir)) {

0 commit comments

Comments
 (0)