[PR #1797] [MERGED] A tool that changes a block ends the click on a server's client #3768

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

📋 Pull Request Information

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

Base: main ← Head: fix/tool-use-on-block-ends-click


📝 Commits (1)

  • df626cf A tool that changes a block ends the click on a server's client

📊 Changes

1 file changed (+14 additions, -3 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+14 -3)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What the player reported

.dezerx on Discord (#horizon-bugs, 2026-10-25, single player): "I cannot hoe the ground if I'm holding a shield?" (a helper added that it worked in earlier versions).

That part is vanilla 26.3: BlockTransformer.playerHasBlockingItemUseIntent makes a main-hand hoe, axe or shovel PASS while the off hand holds a blocks_attacks item (a shield) and the player isn't sneaking, so the shield gets raised instead. Older Minecraft versions tilled. Horizon already follows the rule (block_transform in game.rs), and the server thread behaves the same (tested: no till with a shield, tills without).

The real bug found next to it (#1289, #1266)

On a server's client (single player on the server thread, LAN guests, dedicated servers), a successful tool use on a block (shovel → path, hoe → farmland, axe → stripped log, honeycomb → waxed) didn't end the right-click: the client went on to try the off hand, so a torch in the off hand swung (and was predicted) instead of the shovel.

Vanilla rule

MultiPlayerGameMode.useItemOn → Item.useOn returns InteractionResult.SUCCESS for these transforms; Minecraft.startUseItem swings that hand and returns: the other hand is never tried.

Change

remote.rs: predict_item_on_block now says whether the item's use succeeded; when it did, the client swings that hand and ends the click, as vanilla does. The server side already stopped after the main hand.

Tested

  • Server thread, iron shovel + off-hand torch on grass: the block becomes a dirt path, the main hand swings once, the torch neither swings nor gets placed. Before: the torch swung.
  • Hoe + shield (not sneaking): no till, as vanilla; hoe alone tills.
  • LAN guests and dedicated servers run the same remote.rs code. --in-frame doesn't use it: unchanged.

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 6926c7649, 7 min 8 s)

Check Result
Scope ✅ 1 files, +14 −3
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (12 s)
clippy ✅ (1 min 19 s)
tests: horizon-client ✅ 1222 passed (5 min 3 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 27 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, dedicated_server, dispenser, interaction_input, locator_bar, mace, online_mode, player_sync and 15 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Named harnesses (local, after the build): interaction_input PASS, player_sync PASS.

Fixes #1289
Fixes #1266

🤖 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/1797 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/tool-use-on-block-ends-click` --- ### 📝 Commits (1) - [`df626cf`](https://github.com/horizon-rust/horizon/commit/df626cf2f381ff11ff72a2e7d3793e7078291cca) A tool that changes a block ends the click on a server's client ### 📊 Changes **1 file changed** (+14 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+14 -3) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What the player reported .dezerx on Discord (#horizon-bugs, 2026-10-25, single player): "I cannot hoe the ground if I'm holding a shield?" (a helper added that it worked in earlier versions). That part is vanilla 26.3: `BlockTransformer.playerHasBlockingItemUseIntent` makes a main-hand hoe, axe or shovel PASS while the off hand holds a `blocks_attacks` item (a shield) and the player isn't sneaking, so the shield gets raised instead. Older Minecraft versions tilled. Horizon already follows the rule (`block_transform` in game.rs), and the server thread behaves the same (tested: no till with a shield, tills without). ## The real bug found next to it (#1289, #1266) On a server's client (single player on the server thread, LAN guests, dedicated servers), a successful tool use on a block (shovel → path, hoe → farmland, axe → stripped log, honeycomb → waxed) didn't end the right-click: the client went on to try the off hand, so a torch in the off hand swung (and was predicted) instead of the shovel. ## Vanilla rule `MultiPlayerGameMode.useItemOn` → `Item.useOn` returns `InteractionResult.SUCCESS` for these transforms; `Minecraft.startUseItem` swings that hand and returns: the other hand is never tried. ## Change `remote.rs`: `predict_item_on_block` now says whether the item's use succeeded; when it did, the client swings that hand and ends the click, as vanilla does. The server side already stopped after the main hand. ## Tested - Server thread, iron shovel + off-hand torch on grass: the block becomes a dirt path, the main hand swings once, the torch neither swings nor gets placed. Before: the torch swung. - Hoe + shield (not sneaking): no till, as vanilla; hoe alone tills. - LAN guests and dedicated servers run the same `remote.rs` code. `--in-frame` doesn't use it: unchanged. **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 6926c7649, 7 min 8 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +14 −3 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (12 s) | | clippy | ✅ (1 min 19 s) | | tests: horizon-client | ✅ 1222 passed (5 min 3 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 27 affected, to run in CI (--quick): arrow, block_removal, command_exec, composter, crafter, dedicated_server, dispenser, interaction_input, locator_bar, mace, online_mode, player_sync and 15 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Named harnesses (local, after the build): interaction_input PASS, player_sync PASS. Fixes #1289 Fixes #1266 🤖 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 04:12:10 +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#3768
No description provided.