[PR #5182] [MERGED] Food that can't be placed on the clicked block is eaten on this client too #6126

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5182
Author: @1038april
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/eat-food-that-cannot-be-placed


📝 Commits (1)

  • 3fde6d6 Food that can't be placed on the clicked block is eaten on this client too

📊 Changes

2 files changed (+86 additions, -2 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+25 -0)
📝 tools/lan_e2e.py (+61 -2)

📄 Description

🤖 Opened by 1038april's AI agent (Claude Code, Claude Opus 5.5), not by 1038april personally.

What and why

Fixes #5178

Right-clicking a block with sweet berries, glow berries, a carrot or a potato where it can't be placed showed no eating on the player's own client. The server already fell back to eating for the same UseItemOn, so the item was consumed after its use time with no animation, and letting go couldn't cancel it because the client had no use to release.

remote_use_item_on now starts the use on the client when placement fails, as BlockItem.useOn does. Normal play goes through this path, since single player runs on the server thread. In adventure mode, where ItemStack.useOn passes, the click now falls through so UseItem goes out; if the item's can_place_on matches the block, placing stays with the server.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

BlockItem.useOn (checked in the 26.3 bytecode with javap): place, then Item.useOn, then Item.use when the stack has CONSUMABLE. Consumable.startConsuming: FAIL when it can't be consumed, otherwise startUsingItem and CONSUME.

Harness: new lan_e2e.py --check eat-on-block, which runs a real guest against a real host. Held on stone, the guest's screen shows the eating and the server eats one berry; a click released early eats nothing; on dirt the berry is planted and not eaten. test_use_item_on_parity already covers the server's side, which this doesn't change.

Other projects' code

none

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on KernelOS-PC, against upstream/main at 68ac6f647, 4 min 6 s)

Check Result
Scope ✅ 3 files, +87 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 495 passed (48 s)
rustfmt ✅ (8 s)
clippy ✅ (4 s)
tests: horizon-client ✅ 1337 passed (3 min 2 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The commit changes 2 files (+86 −2). The third file in Scope is an untracked local text file that isn't part of this branch.

Also run on Windows with the fast profile: lan_e2e.py --check eat-on-block --check eat both pass, through a local wrapper because horizon-ctl launch hangs there when its output is piped. The game was also driven in survival and adventure over the server thread. The new check's assertions match behaviour seen failing before the fix, but the check itself was only run with the fix in place.

🤖 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/5182 **Author:** [@1038april](https://github.com/1038april) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/eat-food-that-cannot-be-placed` --- ### 📝 Commits (1) - [`3fde6d6`](https://github.com/horizon-rust/horizon/commit/3fde6d64dda014ceb6d8ad54c5c86323610c4e3f) Food that can't be placed on the clicked block is eaten on this client too ### 📊 Changes **2 files changed** (+86 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+25 -0) 📝 `tools/lan_e2e.py` (+61 -2) </details> ### 📄 Description > 🤖 Opened by 1038april's AI agent (Claude Code, Claude Opus 5.5), not by 1038april personally. ## What and why Fixes #5178 Right-clicking a block with sweet berries, glow berries, a carrot or a potato where it can't be placed showed no eating on the player's own client. The server already fell back to eating for the same `UseItemOn`, so the item was consumed after its use time with no animation, and letting go couldn't cancel it because the client had no use to release. `remote_use_item_on` now starts the use on the client when placement fails, as `BlockItem.useOn` does. Normal play goes through this path, since single player runs on the server thread. In adventure mode, where `ItemStack.useOn` passes, the click now falls through so `UseItem` goes out; if the item's `can_place_on` matches the block, placing stays with the server. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference `BlockItem.useOn` (checked in the 26.3 bytecode with `javap`): `place`, then `Item.useOn`, then `Item.use` when the stack has `CONSUMABLE`. `Consumable.startConsuming`: `FAIL` when it can't be consumed, otherwise `startUsingItem` and `CONSUME`. Harness: new `lan_e2e.py --check eat-on-block`, which runs a real guest against a real host. Held on stone, the guest's screen shows the eating and the server eats one berry; a click released early eats nothing; on dirt the berry is planted and not eaten. `test_use_item_on_parity` already covers the server's side, which this doesn't change. ## Other projects' code none ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on KernelOS-PC, against upstream/main at 68ac6f647, 4 min 6 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +87 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 495 passed (48 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (4 s) | | tests: horizon-client | ✅ 1337 passed (3 min 2 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The commit changes 2 files (+86 −2). The third file in Scope is an untracked local text file that isn't part of this branch. Also run on Windows with the fast profile: `lan_e2e.py --check eat-on-block --check eat` both pass, through a local wrapper because `horizon-ctl launch` hangs there when its output is piped. The game was also driven in survival and adventure over the server thread. The new check's assertions match behaviour seen failing before the fix, but the check itself was only run with the fix in place. 🤖 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:12:30 +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#6126
No description provided.