[PR #4057] [MERGED] A raised shield keeps a sprint from starting, as in vanilla (#3422) #5385

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4057
Author: @degepie
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix/issue-3422-shield-slowdown


📝 Commits (1)

  • b1dcbdc A raised shield (or any item in use) stops a sprint from starting

📊 Changes

3 files changed (+68 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+5 -3)
📝 crates/horizon-client/src/motion.rs (+57 -0)
📝 crates/horizon-items/src/items.rs (+6 -0)

📄 Description

🤖 Opened by degepie's AI agent (Claude Code), not by degepie personally.

Fixes #3422.

What

With a shield raised (either hand), the sprint key or a double-tap of forward started a sprint, so the player moved about 1.3 times faster than vanilla with the shield up (the report's anticheat flags are likely this, but I did not test against GrimAC). Now a raised shield (any item in use whose use_effects do not set can_sprint) keeps a sprint from starting, as in vanilla.

Vanilla

  • LocalPlayer.canStartSprinting refuses while LocalPlayer.isSlowDueToUsingItem holds (item in use and its UseEffects.canSprint false).
  • LocalPlayer.aiStep resets the double-tap window every tick while that holds (and the player is not a passenger).
  • A sprint already running when the shield goes up is not stopped (shouldStopRunSprinting ignores item use); the 0.2 input factor from LocalPlayer.modifyInput already applied in Horizon.
  • Spears set can_sprint (speed multiplier 1.0), so they keep sprinting.

How

  • horizon-items: ItemInfo.can_sprint from use_effects.can_sprint (default false).
  • Game::sync_player_body sets PlayerMotion.item_use_slows_sprint from the item in use; sprint_input_tick_with_window passes it as Conditions.slow_item (the sprint phase already implemented the rule, but nothing fed it).
  • Unit test an_item_in_use_stops_a_sprint_from_starting_unless_it_allows_sprinting.

Verified

In game (release build, offhand shield, flat ground, ticks sampled with horizon-ctl), both on a single-player world and on a LAN guest client:

  • Walking with the shield up was already correct before and after: 0.2054 -> 0.0411 blocks/tick (factor 0.2). The click handling runs before the motion tick in the same client tick, as in vanilla, so I found no one-tick skew by reading the code (not measured).
  • Shield up, then sprint key: before sprinting=true, 0.0549 b/t; after sprinting=false, 0.0425 b/t (still accelerating toward 0.0411-ish walking value).
  • Sprinting, then shield up: sprint kept, as in vanilla.
  • parity.py sprint_input passes (it feeds the conditions directly, so it does not cover the wiring).

Known differences

  • The double-tap case is covered by the unit test only; my in-game attempt to drive a double-tap through horizon-ctl was inconclusive (the no-shield control did not sprint either).
  • Not reproduced: the report mentions "walking"; walking is correct here. I believe it is the double-tap path or a lingering sprint, not confirmed against GrimAC. #3420 and #3421 are not addressed.

pr_ready (--quick, against origin/main c1255761d)

Check Result
Scope 3 files, +68 -3
Python tests pass
rustfmt / clippy pass
tests: horizon-client, horizon-items 688 passed, 1 failed: entity_nbt::axolotl_nbt_tests::bucket_cooldown_and_brain_memories_survive_and_expired_cooldown_is_removed (fails on main itself, #3840)
doc tests / content root tests pass
Parity 352 affected, left to CI (--quick)

🤖 Generated with Claude Code


🔄 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/4057 **Author:** [@degepie](https://github.com/degepie) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix/issue-3422-shield-slowdown` --- ### 📝 Commits (1) - [`b1dcbdc`](https://github.com/horizon-rust/horizon/commit/b1dcbdc0ebf9c72e176208fa3be7096a34c622ab) A raised shield (or any item in use) stops a sprint from starting ### 📊 Changes **3 files changed** (+68 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+5 -3) 📝 `crates/horizon-client/src/motion.rs` (+57 -0) 📝 `crates/horizon-items/src/items.rs` (+6 -0) </details> ### 📄 Description > 🤖 Opened by degepie's AI agent (Claude Code), not by degepie personally. Fixes #3422. ## What With a shield raised (either hand), the sprint key or a double-tap of forward started a sprint, so the player moved about 1.3 times faster than vanilla with the shield up (the report's anticheat flags are likely this, but I did not test against GrimAC). Now a raised shield (any item in use whose `use_effects` do not set `can_sprint`) keeps a sprint from starting, as in vanilla. ## Vanilla - `LocalPlayer.canStartSprinting` refuses while `LocalPlayer.isSlowDueToUsingItem` holds (item in use and its `UseEffects.canSprint` false). - `LocalPlayer.aiStep` resets the double-tap window every tick while that holds (and the player is not a passenger). - A sprint already running when the shield goes up is not stopped (`shouldStopRunSprinting` ignores item use); the 0.2 input factor from `LocalPlayer.modifyInput` already applied in Horizon. - Spears set `can_sprint` (speed multiplier 1.0), so they keep sprinting. ## How - `horizon-items`: `ItemInfo.can_sprint` from `use_effects.can_sprint` (default false). - `Game::sync_player_body` sets `PlayerMotion.item_use_slows_sprint` from the item in use; `sprint_input_tick_with_window` passes it as `Conditions.slow_item` (the sprint phase already implemented the rule, but nothing fed it). - Unit test `an_item_in_use_stops_a_sprint_from_starting_unless_it_allows_sprinting`. ## Verified In game (release build, offhand shield, flat ground, ticks sampled with horizon-ctl), both on a single-player world and on a LAN guest client: - Walking with the shield up was already correct before and after: 0.2054 -> 0.0411 blocks/tick (factor 0.2). The click handling runs before the motion tick in the same client tick, as in vanilla, so I found no one-tick skew by reading the code (not measured). - Shield up, then sprint key: before `sprinting=true`, 0.0549 b/t; after `sprinting=false`, 0.0425 b/t (still accelerating toward 0.0411-ish walking value). - Sprinting, then shield up: sprint kept, as in vanilla. - `parity.py sprint_input` passes (it feeds the conditions directly, so it does not cover the wiring). ## Known differences - The double-tap case is covered by the unit test only; my in-game attempt to drive a double-tap through horizon-ctl was inconclusive (the no-shield control did not sprint either). - Not reproduced: the report mentions "walking"; walking is correct here. I believe it is the double-tap path or a lingering sprint, not confirmed against GrimAC. #3420 and #3421 are not addressed. ## pr_ready (`--quick`, against origin/main c1255761d) | Check | Result | | --- | --- | | Scope | 3 files, +68 -3 | | Python tests | pass | | rustfmt / clippy | pass | | tests: horizon-client, horizon-items | 688 passed, 1 failed: `entity_nbt::axolotl_nbt_tests::bucket_cooldown_and_brain_memories_survive_and_expired_cooldown_is_removed` (fails on main itself, #3840) | | doc tests / content root tests | pass | | Parity | 352 affected, left to CI (--quick) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:12:14 +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#5385
No description provided.