[PR #6461] [MERGED] Toggled sneak and sprint do not outlive the world #6890

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6461
Author: @xFedeT
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fix/world-change-pose


📝 Commits (1)

  • 243c194 Toggled sneak and sprint do not outlive the world

📊 Changes

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

View changed files

📝 crates/horizon-client-input/src/keymapping.rs (+14 -0)
📝 crates/horizon-client/src/game.rs (+14 -0)

📄 Description

🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally.

Fixes #4432

What was wrong

The report says the player's state ("sit, swim") carries over between worlds, single player to multiplayer and back. The state that outlives a world in Horizon is the toggled key mappings (Game.toggles: sneak, sprint, attack, use), which close_world left as they were. With "Toggle Crouch" or "Toggle Sprint" on, a sneak or sprint started in one world was still on after joining the next, which shows as the crouching (sitting) or sprint-swimming pose. Vanilla's LocalPlayer constructor calls KeyMapping.resetToggleKeys() for each new player.

What changes

close_world calls a new reset_toggle_keys: every toggle mapping is put up (KeyState::reset, ToggleKeyMapping.reset), and the latched sneak and sprint keys (self.keys) and the held attack/use flags go with it.

Verification

resetting_the_toggle_keys_puts_every_mapping_up (a sneak and a sprint toggled down are up after the reset). Builds; clippy and rustfmt clean for the changed files (the only clippy error is the existing needless_borrow in horizon-world). I could not tell from the report which pose or setting was meant, so this is the cause I can show from the code, not a confirmed match.

Not done

A respawn or a dimension change also builds a new LocalPlayer in vanilla; only leaving a world resets the toggles here.

🤖 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/6461 **Author:** [@xFedeT](https://github.com/xFedeT) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/world-change-pose` --- ### 📝 Commits (1) - [`243c194`](https://github.com/horizon-rust/horizon/commit/243c194bb78b382dbc4e7fe2715ab732dcdcd6ce) Toggled sneak and sprint do not outlive the world ### 📊 Changes **2 files changed** (+28 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-input/src/keymapping.rs` (+14 -0) 📝 `crates/horizon-client/src/game.rs` (+14 -0) </details> ### 📄 Description > 🤖 Opened by xFedeT's AI agent (Claude Code, Sonnet 5.5), not by xFedeT personally. Fixes #4432 ## What was wrong The report says the player's state ("sit, swim") carries over between worlds, single player to multiplayer and back. The state that outlives a world in Horizon is the toggled key mappings (`Game.toggles`: sneak, sprint, attack, use), which `close_world` left as they were. With "Toggle Crouch" or "Toggle Sprint" on, a sneak or sprint started in one world was still on after joining the next, which shows as the crouching (sitting) or sprint-swimming pose. Vanilla's `LocalPlayer` constructor calls `KeyMapping.resetToggleKeys()` for each new player. ## What changes `close_world` calls a new `reset_toggle_keys`: every toggle mapping is put up (`KeyState::reset`, `ToggleKeyMapping.reset`), and the latched sneak and sprint keys (`self.keys`) and the held attack/use flags go with it. ## Verification `resetting_the_toggle_keys_puts_every_mapping_up` (a sneak and a sprint toggled down are up after the reset). Builds; clippy and rustfmt clean for the changed files (the only clippy error is the existing `needless_borrow` in `horizon-world`). I could not tell from the report which pose or setting was meant, so this is the cause I can show from the code, not a confirmed match. ## Not done A respawn or a dimension change also builds a new `LocalPlayer` in vanilla; only leaving a world resets the toggles here. 🤖 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 06:28:40 +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#6890
No description provided.