[PR #2022] [MERGED] Fix sprint-jump losing its forward impulse #3945

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2022
Author: @mc070309
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: cursor/sprint-jump-impulse-68db


📝 Commits (2)

  • 260dd42 Keep sprint as a state so a sprint-jump keeps its forward impulse
  • a0a1700 Merge main into sprint-jump-impulse

📊 Changes

2 files changed (+189 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/sprint.rs (+73 -0)
📝 crates/horizon-world/src/living_motion.rs (+116 -0)

📄 Description

What and why

A sprint-jump was only a vertical hop once the sprint key came up. Vanilla keeps sprint as a state: tap sprint, or double-tap forward, keep holding forward, then jump. LivingEntity.jumpFromGround adds about 0.2 along look while isSprinting(). That impulse was already implemented, and the client sprint machine already keeps the state after Ctrl is released. The server threw the state away.

Hub handled ServerboundPlayerInputPacket by setting sprinting from the sprint key and the forward key. Any input change after Ctrl came up — including pressing jump — cleared the flag. The server sends that flag back in the shared entity data, and the client copies it onto player.sprinting (the bool only; the sprint speed modifier stays). The next jumpFromGround therefore sees “not sprinting”, skips the 0.2 look-direction impulse, and the hop stays short even though horizontal speed can still look like a sprint.

handlePlayerInput now only records the keys and updates crouching. Start and stop sprinting stay on PlayerCommand, which the client already sends when its sprint state changes. Releasing Ctrl while holding forward leaves the flag set, so the jump gets the impulse. Releasing forward still stops the sprint.

horizon-ctl state's sprinting field reported whether Ctrl was held. It now reports the sprint flag the jump reads.

In-frame movement (--in-frame) does not go through this packet. There the client already keeps sprint and already applies the impulse. The missing boost is the default server-thread game, and the same path on LAN and a dedicated server.

Vanilla reference

ServerGamePacketListenerImpl.handlePlayerInput stores the input and updates crouch. handlePlayerCommand calls setSprinting for start and stop sprinting. LivingEntity.jumpFromGround does addDeltaMovement((-sin(yaw), 0, cos(yaw)) * 0.2) while isSprinting().

How to verify in game

  1. Open a world on the default server thread.
  2. Hold W, tap Ctrl (or double-tap W), release Ctrl, keep holding W. Sprint should continue: wider FOV, sprint speed.
  3. Jump. The hop should carry you clearly farther forward than a walk-jump. horizon-ctl state should still show "sprinting": true after Ctrl is up, and the velocity just after leaving the ground should include that forward kick.
  4. Release W. Sprint should stop, and the next jump should be a plain one.

Verified locally on Windows with a release client built from this branch.

Self-check

tools/pr_ready.py --quick was run against origin/main when this branch was prepared. Pack-overlay cache hash tests that fail are unrelated to this change; sprint-jump unit tests pass (sprint_jump_adds_look_direction_impulse, sprint_survives_releasing_the_key_through_a_jump).


🔄 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/2022 **Author:** [@mc070309](https://github.com/mc070309) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `cursor/sprint-jump-impulse-68db` --- ### 📝 Commits (2) - [`260dd42`](https://github.com/horizon-rust/horizon/commit/260dd423c99eb4339b94e07cb25ea573b095c33c) Keep sprint as a state so a sprint-jump keeps its forward impulse - [`a0a1700`](https://github.com/horizon-rust/horizon/commit/a0a170064ee931c8ded3a1c6833ccafa85ee095f) Merge main into sprint-jump-impulse ### 📊 Changes **2 files changed** (+189 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/sprint.rs` (+73 -0) 📝 `crates/horizon-world/src/living_motion.rs` (+116 -0) </details> ### 📄 Description ## What and why A sprint-jump was only a vertical hop once the sprint key came up. Vanilla keeps sprint as a state: tap sprint, or double-tap forward, keep holding forward, then jump. `LivingEntity.jumpFromGround` adds about 0.2 along look while `isSprinting()`. That impulse was already implemented, and the client sprint machine already keeps the state after Ctrl is released. The server threw the state away. `Hub` handled `ServerboundPlayerInputPacket` by setting `sprinting` from the sprint key and the forward key. Any input change after Ctrl came up — including pressing jump — cleared the flag. The server sends that flag back in the shared entity data, and the client copies it onto `player.sprinting` (the bool only; the sprint speed modifier stays). The next `jumpFromGround` therefore sees “not sprinting”, skips the 0.2 look-direction impulse, and the hop stays short even though horizontal speed can still look like a sprint. `handlePlayerInput` now only records the keys and updates crouching. Start and stop sprinting stay on `PlayerCommand`, which the client already sends when its sprint state changes. Releasing Ctrl while holding forward leaves the flag set, so the jump gets the impulse. Releasing forward still stops the sprint. `horizon-ctl state`'s `sprinting` field reported whether Ctrl was held. It now reports the sprint flag the jump reads. In-frame movement (`--in-frame`) does not go through this packet. There the client already keeps sprint and already applies the impulse. The missing boost is the default server-thread game, and the same path on LAN and a dedicated server. ## Vanilla reference `ServerGamePacketListenerImpl.handlePlayerInput` stores the input and updates crouch. `handlePlayerCommand` calls `setSprinting` for start and stop sprinting. `LivingEntity.jumpFromGround` does `addDeltaMovement((-sin(yaw), 0, cos(yaw)) * 0.2)` while `isSprinting()`. ## How to verify in game 1. Open a world on the default server thread. 2. Hold W, tap Ctrl (or double-tap W), release Ctrl, keep holding W. Sprint should continue: wider FOV, sprint speed. 3. Jump. The hop should carry you clearly farther forward than a walk-jump. `horizon-ctl state` should still show `"sprinting": true` after Ctrl is up, and the velocity just after leaving the ground should include that forward kick. 4. Release W. Sprint should stop, and the next jump should be a plain one. Verified locally on Windows with a release client built from this branch. ## Self-check `tools/pr_ready.py --quick` was run against origin/main when this branch was prepared. Pack-overlay cache hash tests that fail are unrelated to this change; sprint-jump unit tests pass (`sprint_jump_adds_look_direction_impulse`, `sprint_survives_releasing_the_key_through_a_jump`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:29 +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#3945
No description provided.