[PR #1419] [MERGED] Entity use with either hand: bows and food past mobs, off-hand items on mobs, emptied frames #3508

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

📋 Pull Request Information

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

Base: main ← Head: fix/st2-entity-hands


📝 Commits (5)

  • 337d7d7 Entity use with either hand: bows and food past a mob, off-hand items on mobs, emptied frames
  • 0b7fa14 Merge remote-tracking branch 'origin/main' into fix/st2-entity-hands
  • 81fb4c7 Merge remote-tracking branch 'origin/main' into mm1-1419
  • 0a36a6d Merge remote-tracking branch 'origin/main' into mm1-1419
  • c89695d lan_e2e hands: shoot the cow with a half drawn bow so it lives

📊 Changes

10 files changed (+293 additions, -38 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+26 -9)
📝 crates/horizon-client/src/game/armor_stands.rs (+2 -2)
📝 crates/horizon-client/src/game/creatures.rs (+18 -13)
📝 crates/horizon-client/src/game/lan_actions.rs (+5 -0)
📝 crates/horizon-client/src/game/leads.rs (+2 -2)
📝 crates/horizon-client/src/game/mounts.rs (+1 -1)
📝 crates/horizon-client/src/game/remote.rs (+21 -8)
➕ crates/horizon-client/src/game/remote_mob_use.rs (+91 -0)
📝 crates/horizon-client/src/lan/entity.rs (+38 -1)
📝 tools/lan_e2e.py (+89 -2)

📄 Description

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

Fixes for using items while aiming at an entity, and for the off hand.

  • Bows and food past a mob (#1350). The remote client used to send Interact for any mob it aimed at and stop there. It now does what vanilla's client-side Mob.interact would: it predicts whether the mob takes the hand's item (game/remote_mob_use.rs: leads, name tags, spawn eggs, food, villagers, horses, saddled pigs and striders, tamed pets, buckets and shears, ...). It stops only if the mob takes it, so a bow drawn or food eaten while aiming at a cow goes on to useItem.
  • Off hand (#1362). Both hands are tried in Minecraft.startUseItem order: the main hand's entity, block and item, then the off hand's. The server runs Interact with the packet's hand (GuestUse::Entity). Mobs, armour stands, leads and mounts use the stack in that hand. An off-hand bucket milks a cow, and off-hand wheat feeds it.
  • Emptied item frames (#1355). The entity tracker didn't send a frame's item when it went back to empty, or its rotation when it went back to 0. Clients kept drawing the old item, even though the server had already dropped it.
  • lan_e2e hands, for the host and the guest, with a cow (NoAI) in front:
    • a bow is drawn and shot;
    • a short golden apple press doesn't eat it;
    • an off-hand bucket milks the cow, and off-hand wheat goes 3 → 2;
    • a punched frame is empty on both sides.

Fixes #1350
Fixes #1362
Fixes #1355

Proof

  • python3 tools/lan_e2e.py --server-thread --check hands --check frames: both PASS for the host and the guest.
  • python3 tools/lan_e2e.py --check hands --check frames --check riding --check mounts (in-frame): all PASS for the host and the guest. Riding and mounts were run as a control, because mounts.rs and leads.rs now read the held hand.
  • Single player probes in both modes (horizon-ctl):
    • bow at the cow: 5 arrows left (it shot);
    • golden apple after a 5-tick press: kept;
    • off-hand bucket: milk_bucket; off-hand wheat: 2 left and the cow in love;
    • frame: the server's Item is empty and the client draws no item.
      On main the server thread failed the bow (it never drew) and the apple (eaten).
  • New unit test: lan::entity::tests::an_emptied_item_frame_sends_its_empty_item_and_rotation.

Self-check

  • cargo fmt --all; cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test -p horizon-client: all pass
  • tools/parity.py --changed origin/main: 103 of 103 affected harnesses pass. This was one run over all four PRs merged together (8c9cdf9a: #1417 06b4c7fa, #1418 7e5e4697, #1419 337d7d7a, #1420 5d2f1804). The first run found that save_roundtrip saved an allay with InLove 0; #1418's second commit fixes that.

🤖 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/1419 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/st2-entity-hands` --- ### 📝 Commits (5) - [`337d7d7`](https://github.com/horizon-rust/horizon/commit/337d7d7a7a518e425d3f6dc9676f0b41b716a085) Entity use with either hand: bows and food past a mob, off-hand items on mobs, emptied frames - [`0b7fa14`](https://github.com/horizon-rust/horizon/commit/0b7fa14030da38870a457ef202186f256c6060a0) Merge remote-tracking branch 'origin/main' into fix/st2-entity-hands - [`81fb4c7`](https://github.com/horizon-rust/horizon/commit/81fb4c737106a9ff24d19f12d4d5acb79183c741) Merge remote-tracking branch 'origin/main' into mm1-1419 - [`0a36a6d`](https://github.com/horizon-rust/horizon/commit/0a36a6d8c6c8ae24011c39531b38d94850171f4b) Merge remote-tracking branch 'origin/main' into mm1-1419 - [`c89695d`](https://github.com/horizon-rust/horizon/commit/c89695dd93207ad855cd8e5ca07368ecbb17bd95) lan_e2e hands: shoot the cow with a half drawn bow so it lives ### 📊 Changes **10 files changed** (+293 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+26 -9) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+2 -2) 📝 `crates/horizon-client/src/game/creatures.rs` (+18 -13) 📝 `crates/horizon-client/src/game/lan_actions.rs` (+5 -0) 📝 `crates/horizon-client/src/game/leads.rs` (+2 -2) 📝 `crates/horizon-client/src/game/mounts.rs` (+1 -1) 📝 `crates/horizon-client/src/game/remote.rs` (+21 -8) ➕ `crates/horizon-client/src/game/remote_mob_use.rs` (+91 -0) 📝 `crates/horizon-client/src/lan/entity.rs` (+38 -1) 📝 `tools/lan_e2e.py` (+89 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes for using items while aiming at an entity, and for the off hand. - **Bows and food past a mob (#1350).** The remote client used to send `Interact` for any mob it aimed at and stop there. It now does what vanilla's client-side `Mob.interact` would: it predicts whether the mob takes the hand's item (`game/remote_mob_use.rs`: leads, name tags, spawn eggs, food, villagers, horses, saddled pigs and striders, tamed pets, buckets and shears, ...). It stops only if the mob takes it, so a bow drawn or food eaten while aiming at a cow goes on to `useItem`. - **Off hand (#1362).** Both hands are tried in `Minecraft.startUseItem` order: the main hand's entity, block and item, then the off hand's. The server runs `Interact` with the packet's hand (`GuestUse::Entity`). Mobs, armour stands, leads and mounts use the stack in that hand. An off-hand bucket milks a cow, and off-hand wheat feeds it. - **Emptied item frames (#1355).** The entity tracker didn't send a frame's item when it went back to empty, or its rotation when it went back to 0. Clients kept drawing the old item, even though the server had already dropped it. - **lan_e2e `hands`**, for the host and the guest, with a cow (NoAI) in front: - a bow is drawn and shot; - a short golden apple press doesn't eat it; - an off-hand bucket milks the cow, and off-hand wheat goes 3 → 2; - a punched frame is empty on both sides. Fixes #1350 Fixes #1362 Fixes #1355 ## Proof - `python3 tools/lan_e2e.py --server-thread --check hands --check frames`: both PASS for the host and the guest. - `python3 tools/lan_e2e.py --check hands --check frames --check riding --check mounts` (in-frame): all PASS for the host and the guest. Riding and mounts were run as a control, because `mounts.rs` and `leads.rs` now read the held hand. - Single player probes in both modes (`horizon-ctl`): - bow at the cow: 5 arrows left (it shot); - golden apple after a 5-tick press: kept; - off-hand bucket: `milk_bucket`; off-hand wheat: 2 left and the cow in love; - frame: the server's Item is empty and the client draws no item. On main the server thread failed the bow (it never drew) and the apple (eaten). - New unit test: `lan::entity::tests::an_emptied_item_frame_sends_its_empty_item_and_rotation`. ## Self-check - `cargo fmt --all`; `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo test -p horizon-client`: all pass - `tools/parity.py --changed origin/main`: 103 of 103 affected harnesses pass. This was one run over all four PRs merged together (8c9cdf9a: #1417 06b4c7fa, #1418 7e5e4697, #1419 337d7d7a, #1420 5d2f1804). The first run found that `save_roundtrip` saved an allay with InLove 0; #1418's second commit fixes that. 🤖 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:10:01 +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#3508
No description provided.