[PR #5033] [MERGED] Blindness stops a sprint and keeps one from starting #6016

Closed
opened 2026-11-03 05:16:38 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5033
Author: @navinor
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/sprint-blindness


📝 Commits (1)

  • 05a059b Blindness stops a sprint and keeps one from starting

📊 Changes

3 files changed (+93 additions, -6 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+4 -2)
📝 crates/horizon-client/src/motion.rs (+54 -2)
📝 tools/agent_control_e2e.py (+35 -2)

📄 Description

🤖 Opened by navinor's AI agent (OpenCode, Claude Opus 5.5), not by navinor personally.

What and why

Fixes #4831: a blind player could start and keep a sprint.

Vanilla's LocalPlayer.isSprintingPossible returns false while Player.isMobilityRestricted(), which is hasEffect(MobEffects.BLINDNESS). Both canStartSprinting and shouldStopRunSprinting / shouldStopSwimSprinting go through it. Horizon's sprint::Conditions already had mobility_restricted and honours it, but nothing ever set it: PlayerMotion::sprint_input_tick_with_window left it at its default.

This PR:

  • adds PlayerMotion::mobility_restricted and passes it into the sprint conditions;
  • sets it in Game::sync_player_body from the effects the window holds. The server-thread client (tick_remote) runs that before the motion step, and its effects come from ClientboundUpdateMobEffectPacket for its own entity id.

The server side needs nothing: vanilla's server takes the sprint state from the client's player command without checking blindness, and so does the hub.

Not in this PR: while riding, the remote client skips the sprint phase, so a mount still gets the raw sprint key (a blind camel rider can dash). That gap existed before this change and needs passenger-aware sprint decisions of its own.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Vanilla reference

net.minecraft.client.player.LocalPlayer.isSprintingPossible, net.minecraft.world.entity.player.Player.isMobilityRestricted. tools/port_ledger.py check --base origin/main: Player.isMobilityRestricted: trivial -> mentioned.

What checks it:

  • The sprint_input harness (tools/test_sprint_input_parity.py) already compares the sprint decisions with isMobilityRestricted set; this PR feeds that input.
  • motion::tests::blindness_stops_a_sprint_and_keeps_one_from_starting: a held sprint key starts a sprint, blindness stops it and keeps it stopped for 10 ticks, clearing it lets the sprint start again. It fails when mobility_restricted is not passed into the conditions.
  • tools/agent_control_e2e.py --scenario consume now ends with a sprint check in a real game on its server thread: hold W and the sprint key in a stone tunnel, /effect give @s minecraft:blindness while sprinting, check the sprint stopped, check the key can't start one while blind, /effect clear, check it starts again. The effect goes through the server and ClientboundUpdateMobEffectPacket, so this covers the wiring the unit test doesn't. Run by hand on Windows in CLI mode (through a small local wrapper, since the script expects vscreen and symlinks):
    • with this PR: [cli] PASS in 25 s
    • with the sync_player_body line disabled: [cli] FAIL: AssertionError('blindness did not stop a running sprint')
  • Driven by hand with horizon-ctl, 3 s of held sprint on flat stone: 17.28 blocks seeing, 13.34 blind (walking speed, sprinting: false), 17.28 after the effect cleared; with the sync_player_body line disabled, the blind run also covered 17.28 blocks.

Other projects' code

None.

Self-check

pr_ready (tools/pr_ready.py --quick on Aaron, against origin/main at 9d979caa4, 8 min 3 s)

Check Result
Scope ✅ 3 files, +93 −6
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (59 s)
rustfmt ✅ (8 s)
clippy ✅ (49 s)
tests: horizon-client ✅ 1331 passed (5 min 59 s)
doc tests ✅ 0 passed (4 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Harnesses were not run here: tools/parity.py needs fcntl, so it doesn't run on Windows; CI's parity job picks them.

🤖 Generated with OpenCode


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5033 **Author:** [@navinor](https://github.com/navinor) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/sprint-blindness` --- ### 📝 Commits (1) - [`05a059b`](https://github.com/horizon-rust/horizon/commit/05a059bde4e4963897bdfb907d061738bbe24a56) Blindness stops a sprint and keeps one from starting ### 📊 Changes **3 files changed** (+93 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+4 -2) 📝 `crates/horizon-client/src/motion.rs` (+54 -2) 📝 `tools/agent_control_e2e.py` (+35 -2) </details> ### 📄 Description > 🤖 Opened by navinor's AI agent (OpenCode, Claude Opus 5.5), not by navinor personally. ## What and why Fixes #4831: a blind player could start and keep a sprint. Vanilla's `LocalPlayer.isSprintingPossible` returns false while `Player.isMobilityRestricted()`, which is `hasEffect(MobEffects.BLINDNESS)`. Both `canStartSprinting` and `shouldStopRunSprinting` / `shouldStopSwimSprinting` go through it. Horizon's `sprint::Conditions` already had `mobility_restricted` and honours it, but nothing ever set it: `PlayerMotion::sprint_input_tick_with_window` left it at its default. This PR: - adds `PlayerMotion::mobility_restricted` and passes it into the sprint conditions; - sets it in `Game::sync_player_body` from the effects the window holds. The server-thread client (`tick_remote`) runs that before the motion step, and its effects come from `ClientboundUpdateMobEffectPacket` for its own entity id. The server side needs nothing: vanilla's server takes the sprint state from the client's player command without checking blindness, and so does the hub. Not in this PR: while riding, the remote client skips the sprint phase, so a mount still gets the raw sprint key (a blind camel rider can dash). That gap existed before this change and needs passenger-aware sprint decisions of its own. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Vanilla reference `net.minecraft.client.player.LocalPlayer.isSprintingPossible`, `net.minecraft.world.entity.player.Player.isMobilityRestricted`. `tools/port_ledger.py check --base origin/main`: `Player.isMobilityRestricted: trivial -> mentioned`. What checks it: - The `sprint_input` harness (`tools/test_sprint_input_parity.py`) already compares the sprint decisions with `isMobilityRestricted` set; this PR feeds that input. - `motion::tests::blindness_stops_a_sprint_and_keeps_one_from_starting`: a held sprint key starts a sprint, blindness stops it and keeps it stopped for 10 ticks, clearing it lets the sprint start again. It fails when `mobility_restricted` is not passed into the conditions. - `tools/agent_control_e2e.py --scenario consume` now ends with a sprint check in a real game on its server thread: hold W and the sprint key in a stone tunnel, `/effect give @s minecraft:blindness` while sprinting, check the sprint stopped, check the key can't start one while blind, `/effect clear`, check it starts again. The effect goes through the server and `ClientboundUpdateMobEffectPacket`, so this covers the wiring the unit test doesn't. Run by hand on Windows in CLI mode (through a small local wrapper, since the script expects vscreen and symlinks): - with this PR: `[cli] PASS in 25 s` - with the `sync_player_body` line disabled: `[cli] FAIL: AssertionError('blindness did not stop a running sprint')` - Driven by hand with `horizon-ctl`, 3 s of held sprint on flat stone: 17.28 blocks seeing, 13.34 blind (walking speed, `sprinting: false`), 17.28 after the effect cleared; with the `sync_player_body` line disabled, the blind run also covered 17.28 blocks. ## Other projects' code None. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Aaron, against origin/main at 9d979caa4, 8 min 3 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +93 −6 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (59 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (49 s) | | tests: horizon-client | ✅ 1331 passed (5 min 59 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Harnesses were not run here: `tools/parity.py` needs `fcntl`, so it doesn't run on Windows; CI's parity job picks them. 🤖 Generated with [OpenCode](https://opencode.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:38 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#6016
No description provided.