Fix Elytra re-deploy recovery #13
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
6b6t/NoCheatPlus!13
Loading…
Reference in a new issue
No description provided.
Delete branch "codex/fix-mace-elytra-packetfly"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Check the 20-tick relight lockout when the server decides whether to allow a glide, even if no moves were accepted. Require a valid previous glide before starting a new lockout. Ground contact and clean movement still allow earlier recovery.
Java 25
mvn packagepassed. Three runs of the supplied 1.21.11 Mineflayer re-deploy scenario on Folia 26.2 accepted both glide starts with zero re-deploy corrections.Summary by CodeRabbit
Walkthrough
The movement checks now distinguish usable Elytra from depleted Elytra. They also track rejected airborne glide toggles and block relighting until the block expires or recovery conditions clear it.
Changes: Elytra movement handling
NCPCore/src/main/java/fr/neatmonster/nocheatplus/compat/Bridge1_9.java,NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/ElytraResidual.java,NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/player/SurvivalFly.java,NCPPlugin/src/test/java/fr/neatmonster/nocheatplus/TestElytraFlyTransition.java,NCPPlugin/src/test/java/fr/neatmonster/nocheatplus/TestElytraResidualLifecycle.javaBridge1_9determines whether a chest-slot Elytra is usable from its durability metadata. Residual movement handling uses that state, and tests cover durability boundaries and handoffs.NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingData.java,NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.java,NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/util/MovingUtil.java,NCPPlugin/src/test/java/fr/neatmonster/nocheatplus/TestElytraFlyTransition.java,NCPPlugin/src/test/java/fr/neatmonster/nocheatplus/TestElytraSwapEnvelope.javaMovingUtilrejects glide and lift-off checks while the block is active. Recovery and cleanup rules are covered by tests.Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Sequence Diagram(s)
Suggested reviewers:
qbastyMerge Risk:
Moderate · previous review
5ae17Players who stop gliding with a working Elytra may be set back and then briefly unable to start gliding again. This is a narrow, bounded false-positive risk. The change otherwise fixes Elytra re-deploy recovery. Resolve the glide-stop momentum handling before merging; the ground-contact recovery gap is a small follow-through fix.
Pre-merge checks:
4
Full details: Title check
Explanation
The title "Fix Elytra re-deploy recovery" matches the main change in the changeset. The objectives describe a fix for Elytra re-deploy handling, including the 20-tick relight lockout, the requirement for a valid prior glide before a new lockout starts, and earlier recovery on ground contact or clean movement. The file changes (MovingData relight block, MovingListener, MovingUtil, SurvivalFly, Bridge1_9 usable-elytra check, and the related tests) all support this title. The title is concise, specific, and free of file lists or vague terms.
Finishing Touches
Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Share
Thanks for the captures. They showed that the candidate was already blocking the first glide start. In each run, 28 of the 36 position corrections arrived before the re-deploy request.
What this changes
Verification
I ran the supplied 1.21.11 Mineflayer re-deploy scenario three times on Folia 26.2 with an expired lockout seeded. The server accepted both glide starts in all three runs. Each run had one or two initial corrections and zero corrections at re-deploy. The Java 25 Maven build passed with 928 tests passed and 5 skipped.
@coderabbitai full review
Action performed
Full review finished.
Actionable comments posted: 2
d2c75f84-5f2f-4a80-b428-3d5800f74a84Reviewing files that changed from the base of the PR and between
7370f5a4deand5ae17ed8f9.NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/ElytraResidual.javaNCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingData.javaNCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/MovingListener.javaNCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/player/SurvivalFly.javaNCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/moving/util/MovingUtil.javaNCPCore/src/main/java/fr/neatmonster/nocheatplus/compat/Bridge1_9.javaNCPPlugin/src/test/java/fr/neatmonster/nocheatplus/TestElytraFlyTransition.javaNCPPlugin/src/test/java/fr/neatmonster/nocheatplus/TestElytraResidualLifecycle.javaNCPPlugin/src/test/java/fr/neatmonster/nocheatplus/TestElytraSwapEnvelope.javaIncluded review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
@ -1598,6 +1604,7 @@ catch (java.lang.Throwable thr) {}else thisMove.invalidate();Clear the relight lockout when the move touches ground.
An accepted move can set
thisMove.touchedGroundwhile neither endpoint isonGroundOrResetCond. The recovery call passes onlythisMove.to.onGroundOrResetCond, so the lockout stays active in that case until ten such moves or the 20-tick deadline. A glide restart can then be rejected after ground contact. The PR states that ground contact can allow earlier recovery. IncludethisMove.touchedGroundin the recovery input. Ordinary airborne moves keep the lockout.Suggested fix
Committable suggestion
@ -1965,6 +1978,15 @@ catch (java.lang.Throwable thr) {}if (debug) debug(player, "*** Transition from CreativeFly to SurvivalFly: Add velocity.");Keep momentum credit when a usable Elytra stops gliding.
When a player stops gliding while still wearing a usable Elytra, the transition into SurvivalFly returns before it adds the velocity that the transition normally grants. The glide distance is not in the velocity queue, so the early return removes its momentum credit. The next coast move can then exceed SurvivalFly's horizontal allowance. This can cause a correction and a relight block for legitimate movement.
The stop transition must keep the momentum credit that
workaroundFlyCheckTransitioncomputes fromlastMove. The no-credit behavior is only needed to stop repeated toggles from renewing flight credit. Limit that behavior to the input that renews credit, using the existingdelayWorkaroundgate or another boundary that the implementation defines.Thanks for the update. Lab and review results below.
Lab (commit
5ae17ed, one commit behind the current headee8fa0e)Test server, Folia, 1.21.11 Mineflayer harness, three runs per case. Corrections are server position corrections sent to the moving bot. Our runs start cold; we do not seed an expired lockout.
7370f5a)5ae17edOnly one PR re-deploy run hit the 0–2 range, and two runs were above live. The mace/dive hit numbers from this run are left out: the live control did not land hits on our test server, so they cannot be compared. NCP debug output was also not captured, so we cannot say which check made each correction.
ee8fa0e(glide coast) came after our build and is not tested yet. We will rebuild it and repeat the same runs, plus a steep-dive stop and a rocket-climb stop.Review of
ee8fa0eNo fly or PacketFly path found through the 20-tick expiry or the invalidated-history rule. Expiry only returns to normal lift-off and CreativeFly checks, airborne toggles no longer add velocity, and teleports/setbacks break the coast chain (
isSamePos).ElytraResidual.matchesGlideCoast, first move: it needs|y - lastY| <= 0.005andlastY < -0.08. In vanilla the first non-glide move is about0.98 * lastY(and0.99 * lastHhorizontally), so this only fits|lastY| <= 0.25. A glide that stops during a steep dive (vy < -0.25), a rocket climb (vy > 0) or at rocket speed gets no coast credit, is set back and arms the lockout. The only test (glideExitMustMatchCarriedVelocityOrAirDrag) uses vy = -0.18. Suggest comparing to0.98 * lastY/0.99 * lastHwith the same margins. False-flag risk only, not a bypass.0.91 * lastH + 0.04, measured from the actual previous move, so speed can settle near 0.04 / 0.09 ≈ 0.44 b/t (vanilla sprint air ≈ 0.29) for up to 40 moves, and a one-tick re-glide restarts the window. Bounded extra steering, no flight. Suggest measuring against the previous predicted speed or using 0.026 plus a small epsilon.MovingListenerairborne-toggle early return also skipsclearActiveHorVel(),bunnyhopDelay = 0andsetFrictionJumpPhase(). Kept velocity is covered bytogglingKeepsRealVelocityAvailable; a test for the 2nd–3rd exit move when the coast check fails would help.On our side: the 20-tick deadline here covers what our #22 did, so #22 is not needed once this merges. #25 was built on the old #13 and would need a rebase or be dropped.