[PR #1779] [MERGED] Fix sprint FOV getting stuck after releasing Ctrl #3757

Closed
opened 2026-11-03 04:12:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1779
Author: @levzzz5154
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @ludovic111

Base: main ← Head: fix/sprint-fov-stuck


📝 Commits (2)

  • 57ee081 Keep sprint state independent of held sprint keys
  • e069750 Merge origin/main into fix/sprint-fov-stuck

📊 Changes

4 files changed (+110 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game/agent.rs (+2 -1)
📝 crates/horizon-client/src/lan/hub.rs (+3 -1)
📝 crates/horizon-client/tests/lan_bot.rs (+59 -0)
📝 tools/lan_e2e.py (+46 -0)

📄 Description

🤖 Opened by levzzz5154's AI agent (OpenAI Codex, GPT-6), not by levzzz5154.

What and why

Releasing Ctrl while still holding W could leave the sprint FOV stuck after the player stopped moving. The server derived its sprint flag from held keys and sent the cleared flag back to the client while the client's sprint speed modifier remained active. The client then skipped its normal sprint-stop cleanup because its flag was already false. Double-tap sprinting could hit the same mismatch.

Let PlayerCommand start and stop sprinting, without overwriting that state from PlayerInput. Agent state now reports the actual sprint flag and exposes the camera FOV modifier so the gameplay regression can check recovery.

Vanilla reference

Follows Minecraft 26.3 ServerGamePacketListenerImpl.handlePlayerInput (records input and updates crouching) and handlePlayerCommand (calls setSprinting for start/stop). LivingEntity.setSprinting manages the movement-speed modifier, which AbstractClientPlayer.getFieldOfViewModifier reads.

Regression coverage:

  • lan_bot::sprint_commands_survive_keyboard_input_changes failed before the fix when Ctrl was released with W still held; all three LAN integration tests pass after the fix.
  • New lan_e2e.py --check sprint-fov passes with both an in-frame host and --server-thread, checking the host and LAN guest in each run. Measured FOV multiplier: approximately 1.15 while sprinting, including after releasing Ctrl, then 1.0 after releasing W. These gameplay runs used isolated homes and offscreen rendering on the pre-rebase fix; the rebase adds upstream's unrelated resource-pack progress changes.
  • cargo build --locked --profile fast -p horizon-client --bins passed before the rebase.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, against upstream/main at fbfec6435, 3 min 10 s)

Check Result
Scope ✅ 4 files, +110 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 267 passed (17 s)
rustfmt ✅ (4 s)
clippy ✅ (26 s)
tests: horizon-client ✅ 1218 passed (2 min 21 s)
doc tests ✅ 0 passed (1 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 266 affected, to run in CI (--quick): ambient_sound, arrow, audio_attributes, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_transformer, breaking_model, camera and 254 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with OpenAI Codex.


🔄 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/1779 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/sprint-fov-stuck` --- ### 📝 Commits (2) - [`57ee081`](https://github.com/horizon-rust/horizon/commit/57ee0810381b2d1d271fcfa6678bb8de456c7151) Keep sprint state independent of held sprint keys - [`e069750`](https://github.com/horizon-rust/horizon/commit/e069750ca13f83c00adf129bc75bfe3104476c04) Merge origin/main into fix/sprint-fov-stuck ### 📊 Changes **4 files changed** (+110 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/agent.rs` (+2 -1) 📝 `crates/horizon-client/src/lan/hub.rs` (+3 -1) 📝 `crates/horizon-client/tests/lan_bot.rs` (+59 -0) 📝 `tools/lan_e2e.py` (+46 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (OpenAI Codex, GPT-6), not by levzzz5154. ## What and why Releasing Ctrl while still holding W could leave the sprint FOV stuck after the player stopped moving. The server derived its sprint flag from held keys and sent the cleared flag back to the client while the client's sprint speed modifier remained active. The client then skipped its normal sprint-stop cleanup because its flag was already false. Double-tap sprinting could hit the same mismatch. Let `PlayerCommand` start and stop sprinting, without overwriting that state from `PlayerInput`. Agent state now reports the actual sprint flag and exposes the camera FOV modifier so the gameplay regression can check recovery. ## Vanilla reference Follows Minecraft 26.3 `ServerGamePacketListenerImpl.handlePlayerInput` (records input and updates crouching) and `handlePlayerCommand` (calls `setSprinting` for start/stop). `LivingEntity.setSprinting` manages the movement-speed modifier, which `AbstractClientPlayer.getFieldOfViewModifier` reads. Regression coverage: - `lan_bot::sprint_commands_survive_keyboard_input_changes` failed before the fix when Ctrl was released with W still held; all three LAN integration tests pass after the fix. - New `lan_e2e.py --check sprint-fov` passes with both an in-frame host and `--server-thread`, checking the host and LAN guest in each run. Measured FOV multiplier: approximately 1.15 while sprinting, including after releasing Ctrl, then 1.0 after releasing W. These gameplay runs used isolated homes and offscreen rendering on the pre-rebase fix; the rebase adds upstream's unrelated resource-pack progress changes. - `cargo build --locked --profile fast -p horizon-client --bins` passed before the rebase. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, against upstream/main at fbfec6435, 3 min 10 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +110 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 267 passed (17 s) | | rustfmt | ✅ (4 s) | | clippy | ✅ (26 s) | | tests: horizon-client | ✅ 1218 passed (2 min 21 s) | | doc tests | ✅ 0 passed (1 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 266 affected, to run in CI (--quick): ambient_sound, arrow, audio_attributes, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, block_transformer, breaking_model, camera and 254 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [OpenAI Codex](https://chatgpt.com/codex). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:12:06 +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#3757
No description provided.