[PR #4498] [CLOSED] An open screen releases the item being used #5657

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4498
Author: @CocofireHD
Created: 10/30/2026
Status: ❌ Closed

Base: main ← Head: fix/item-use-screen


📝 Commits (1)

  • a3be397 An open screen releases the item being used

📊 Changes

2 files changed (+32 additions, -18 deletions)

View changed files

📝 crates/horizon-client/src/game/hand.rs (+3 -0)
📝 crates/horizon-client/src/game/remote.rs (+29 -18)

📄 Description

🤖 Opened by CocofireHD's AI agent (Hermes Agent, deepseek-v4.1-flash), not by CocofireHD personally.

Fixes #4472.

What

A use that is already running no longer survives a screen opening. Eating, drinking, drawing a bow: the item is released as the inventory (or a chest, or the pause menu) comes up instead of finishing behind the GUI.

Why it happened

The use tick only runs while screen == Screen::Playing, which mirrors Minecraft.handleKeybinds() (it runs only with no screen and no overlay). Mining was already cancelled there (stop_remote_mining), but nothing released the use: self.using kept its countdown next to the open screen, so the item was consumed behind it.

The change

  • Game::release_using_item() — MultiPlayerGameMode.releaseUsingItem: the PLAYER_ACTION packet, then Item.releaseUsing on the client (a riptide launch moves the player itself). Moved out of RemoteInputWorld::release_using, which now calls it.
  • Called from remote_handle_input when the game is not ready (a screen is open, the player sleeps, the world is not loaded yet) and from the local hand path's non-playing branch.

Evidence

Singleplayer world, 8 golden apples in the hotbar, right button held, the inventory opened 0.7 s into the 1.6 s use and kept open for 2.5 s (horizon-ctl):

Build Stack after the screen was open status.using
main (594b50b5) 7 — eaten behind the inventory null, the use finished
this PR 8 — released when the screen opened null, released

main, inventory open, apple already eaten:

main: the apple is eaten behind the open inventory

This PR, same moment, the apple still there:

this PR: the use is released, the stack is untouched

Control (no screen opened): holding the button still eats the apple, 8 → 7, so the release only happens when a screen opens.

Checks

  • cargo fmt --all -- --check ✅
  • cargo clippy -p horizon-client --all-targets -- -D warnings ✅
  • python3 tools/pr_ready.py --quick: 781 passed, 1 failed — title::tests::each_world_preset_writes_its_own_generator fails the same way on clean main (594b50b5), so it is unrelated to this change:
$ git checkout 594b50b5 && cargo test -p horizon-client --lib title::tests::each_world_preset_writes_its_own_generator
failures:
    title::tests::each_world_preset_writes_its_own_generator
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 801 filtered out

Parity is left to CI, as --quick does.

🤖 Generated with Hermes Agent


🔄 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/4498 **Author:** [@CocofireHD](https://github.com/CocofireHD) **Created:** 10/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/item-use-screen` --- ### 📝 Commits (1) - [`a3be397`](https://github.com/horizon-rust/horizon/commit/a3be39741cad75eba298c506aa8f192fb733a7ab) An open screen releases the item being used ### 📊 Changes **2 files changed** (+32 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/hand.rs` (+3 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+29 -18) </details> ### 📄 Description > 🤖 Opened by CocofireHD's AI agent (Hermes Agent, deepseek-v4.1-flash), not by CocofireHD personally. Fixes #4472. ## What A use that is already running no longer survives a screen opening. Eating, drinking, drawing a bow: the item is released as the inventory (or a chest, or the pause menu) comes up instead of finishing behind the GUI. ## Why it happened The use tick only runs while `screen == Screen::Playing`, which mirrors `Minecraft.handleKeybinds()` (it runs only with no screen and no overlay). Mining was already cancelled there (`stop_remote_mining`), but nothing released the *use*: `self.using` kept its countdown next to the open screen, so the item was consumed behind it. ## The change - `Game::release_using_item()` — `MultiPlayerGameMode.releaseUsingItem`: the `PLAYER_ACTION` packet, then `Item.releaseUsing` on the client (a riptide launch moves the player itself). Moved out of `RemoteInputWorld::release_using`, which now calls it. - Called from `remote_handle_input` when the game is not `ready` (a screen is open, the player sleeps, the world is not loaded yet) and from the local hand path's non-playing branch. ## Evidence Singleplayer world, 8 golden apples in the hotbar, right button held, the inventory opened 0.7 s into the 1.6 s use and kept open for 2.5 s (`horizon-ctl`): | Build | Stack after the screen was open | `status.using` | | --- | --- | --- | | `main` (`594b50b5`) | **7** — eaten behind the inventory | `null`, the use finished | | this PR | **8** — released when the screen opened | `null`, released | `main`, inventory open, apple already eaten: ![main: the apple is eaten behind the open inventory](https://raw.githubusercontent.com/CocofireHD/horizon/pr-assets/4472-item-use/shots/before-2-inventory.png) This PR, same moment, the apple still there: ![this PR: the use is released, the stack is untouched](https://raw.githubusercontent.com/CocofireHD/horizon/pr-assets/4472-item-use/shots/after-2-inventory.png) Control (no screen opened): holding the button still eats the apple, 8 → 7, so the release only happens when a screen opens. ## Checks - `cargo fmt --all -- --check` ✅ - `cargo clippy -p horizon-client --all-targets -- -D warnings` ✅ - `python3 tools/pr_ready.py --quick`: 781 passed, 1 failed — `title::tests::each_world_preset_writes_its_own_generator` fails the same way on clean `main` (`594b50b5`), so it is unrelated to this change: ``` $ git checkout 594b50b5 && cargo test -p horizon-client --lib title::tests::each_world_preset_writes_its_own_generator failures: title::tests::each_world_preset_writes_its_own_generator test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 801 filtered out ``` Parity is left to CI, as `--quick` does. 🤖 Generated with [Hermes Agent](https://hermes-agent.nousresearch.com) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:14:07 +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#5657
No description provided.