[PR #1726] [MERGED] Fix offhand eating and drinking cancellation #3721

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

📋 Pull Request Information

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

Base: main ← Head: t3/9a51354a


📝 Commits (2)

  • e334dd3 Fix offhand eating and drinking cancellation
  • 5a0e650 Offhand use: one in-hand check for held and consumed items

📊 Changes

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

View changed files

📝 crates/horizon-client/src/game/remote.rs (+6 -4)
📝 tools/lan_e2e.py (+79 -0)

📄 Description

🤖 Opened by rdbt's AI agent (OpenCode, gpt-6.1-sol), not by rdbt himself.

What and why

Fixes #1293.

  • Apply the existing offhand-slot exemption to consumables in remote_tick_using. Offhand eating and drinking stay tracked until button release, so the client sends RELEASE_USE_ITEM and the server cancels consumption.
  • Add a focused consume-release LAN regression check for golden apples and milk in both hands, checking early cancellation and normal completion for the host and guest.

Vanilla reference

Inspected the pinned Minecraft 26.3 client bytecode with javap:

  • LivingEntity.updatingUsingItem checks the stack in the hand actually being used.
  • Minecraft.handleKeybinds releases active item use when the use key is no longer down.
  • MultiPlayerGameMode.releaseUsingItem sends RELEASE_USE_ITEM before releasing the player's item use locally.

The regression check is tools/lan_e2e.py --check consume-release, also with --server-thread.

Self-check

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at f2f58aca9, 11 min 58 s)

Check Result
Scope ✅ 2 files, +81 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 252 passed (32 s)
rustfmt ✅ (21 s)
clippy ✅ (1 min 31 s)
tests: horizon-client ✅ 1201 passed (9 min 3 s)
doc tests ✅ 0 passed (16 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 168 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, dedicated_server, dispenser, feature_region, fill_layer, finalize_spawn, fire_starter_sound, first_person and 156 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Before the rebase, the full parity invocation exceeded a 20-minute tool timeout. The five completed harnesses (arrow, block_removal, command_exec, composter, crafter) passed; the remaining affected parity checks are listed for CI.

Gameplay regression

The new consume-release check passed using this branch's release binary and an Xvfb/offscreen wrapper:

  • In-frame host: 8 cases passed.
  • Server-thread host: 8 cases passed.

Each mode covers host/guest × main/off hand × golden apple/milk. Every case checks that a short press starts use on both client and server, releasing ends it on both, waiting beyond the consumption duration preserves the item and effects, and a sustained press still consumes normally (including the milk's empty bucket).

To rerun with the repository's normal display harness:

python3 tools/lan_e2e.py --check consume-release
python3 tools/lan_e2e.py --server-thread --check consume-release

🤖 Generated with OpenCode (agentrouter/gpt-6.1-sol).


🔄 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/1726 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `t3/9a51354a` --- ### 📝 Commits (2) - [`e334dd3`](https://github.com/horizon-rust/horizon/commit/e334dd3d551e4f945682808e5a4ea4c0bdd673de) Fix offhand eating and drinking cancellation - [`5a0e650`](https://github.com/horizon-rust/horizon/commit/5a0e650e639dffd8a7e009699f662302f8b28efe) Offhand use: one in-hand check for held and consumed items ### 📊 Changes **2 files changed** (+85 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+6 -4) 📝 `tools/lan_e2e.py` (+79 -0) </details> ### 📄 Description > 🤖 Opened by rdbt's AI agent (OpenCode, gpt-6.1-sol), not by rdbt himself. ## What and why Fixes #1293. - Apply the existing offhand-slot exemption to consumables in `remote_tick_using`. Offhand eating and drinking stay tracked until button release, so the client sends `RELEASE_USE_ITEM` and the server cancels consumption. - Add a focused `consume-release` LAN regression check for golden apples and milk in both hands, checking early cancellation and normal completion for the host and guest. ## Vanilla reference Inspected the pinned Minecraft 26.3 client bytecode with `javap`: - `LivingEntity.updatingUsingItem` checks the stack in the hand actually being used. - `Minecraft.handleKeybinds` releases active item use when the use key is no longer down. - `MultiPlayerGameMode.releaseUsingItem` sends `RELEASE_USE_ITEM` before releasing the player's item use locally. The regression check is `tools/lan_e2e.py --check consume-release`, also with `--server-thread`. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at f2f58aca9, 11 min 58 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +81 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 252 passed (32 s) | | rustfmt | ✅ (21 s) | | clippy | ✅ (1 min 31 s) | | tests: horizon-client | ✅ 1201 passed (9 min 3 s) | | doc tests | ✅ 0 passed (16 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 168 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, dedicated_server, dispenser, feature_region, fill_layer, finalize_spawn, fire_starter_sound, first_person and 156 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Before the rebase, the full parity invocation exceeded a 20-minute tool timeout. The five completed harnesses (`arrow`, `block_removal`, `command_exec`, `composter`, `crafter`) passed; the remaining affected parity checks are listed for CI. ### Gameplay regression The new `consume-release` check passed using this branch's release binary and an Xvfb/offscreen wrapper: - **In-frame host:** 8 cases passed. - **Server-thread host:** 8 cases passed. Each mode covers host/guest × main/off hand × golden apple/milk. Every case checks that a short press starts use on both client and server, releasing ends it on both, waiting beyond the consumption duration preserves the item and effects, and a sustained press still consumes normally (including the milk's empty bucket). To rerun with the repository's normal display harness: ```sh python3 tools/lan_e2e.py --check consume-release python3 tools/lan_e2e.py --server-thread --check consume-release ``` 🤖 Generated with [OpenCode](https://opencode.ai) (`agentrouter/gpt-6.1-sol`). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:11:42 +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#3721
No description provided.