[GH-ISSUE #4778] An off-hand item use is flagged as 3 where vanilla sends 2, and the reader only reads bit 0 #1447

Closed
opened 2026-11-02 15:47:01 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @sirrayi on GitHub (Oct 30, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4778

Originally assigned to: @navinor on GitHub.

🤖 Filed by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi themselves.

What happens

A living entity's "using item" flags are sent wrong for the off hand, and read wrong on the way back, so the two mistakes cancel out inside Horizon and break interop.

  • crates/horizon-client/src/game/lan.rs:2541 encodes an off-hand use as 1 | 2 = 3.
  • crates/horizon-client/src/game/remote_mob_data.rs:61 only ever sets using_item from bit 0 (index 8 of the entity data).

Vanilla's LivingEntity.startUsingItem sets the two flags independently — setLivingEntityFlag(1, hand == MAIN_HAND) and setLivingEntityFlag(2, hand == OFF_HAND) — so a main-hand use is 1, an off-hand use is 2, and 3 (both hands at once) is a state vanilla never produces. A vanilla client reading Horizon's 3 concludes the main hand is in use, so a raised off-hand shield does not look raised; and Horizon's own reader cannot see a vanilla client's off-hand use at all, because it ignores bit 1.

Suggested fix

Send 1 for the main hand and 2 for the off hand, and read both bits: bit 0 sets "using main hand", bit 1 sets "using off hand" (the live-entity flag index is shared with riptiding and auto_spinning, so read the byte once and mask). The two ends have to change together or the pose stops working, which is presumably how the current encoding came about.

Related

#3420 ("can't see other people using their shield") is the visible symptom and may be exactly this; #3421 is the same reporter's anticheat report minutes later. This one is a parity defect on its own even if the render half is elsewhere.

Found while triaging #3420; tools/lan_e2e.py has worn, hands and swings checks but none for a use pose, so a new check would be the regression test.

Originally created by @sirrayi on GitHub (Oct 30, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/4778 Originally assigned to: @navinor on GitHub. > 🤖 Filed by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi themselves. **What happens** A living entity's "using item" flags are sent wrong for the off hand, and read wrong on the way back, so the two mistakes cancel out inside Horizon and break interop. - `crates/horizon-client/src/game/lan.rs:2541` encodes an off-hand use as `1 | 2 = 3`. - `crates/horizon-client/src/game/remote_mob_data.rs:61` only ever sets `using_item` from bit 0 (index 8 of the entity data). Vanilla's `LivingEntity.startUsingItem` sets the two flags independently — `setLivingEntityFlag(1, hand == MAIN_HAND)` and `setLivingEntityFlag(2, hand == OFF_HAND)` — so a main-hand use is `1`, an off-hand use is `2`, and `3` (both hands at once) is a state vanilla never produces. A vanilla client reading Horizon's `3` concludes the main hand is in use, so a raised off-hand shield does not look raised; and Horizon's own reader cannot see a vanilla client's off-hand use at all, because it ignores bit 1. **Suggested fix** Send `1` for the main hand and `2` for the off hand, and read both bits: bit 0 sets "using main hand", bit 1 sets "using off hand" (the live-entity flag index is shared with `riptiding` and `auto_spinning`, so read the byte once and mask). The two ends have to change together or the pose stops working, which is presumably how the current encoding came about. **Related** #3420 ("can't see other people using their shield") is the visible symptom and may be exactly this; #3421 is the same reporter's anticheat report minutes later. This one is a parity defect on its own even if the render half is elsewhere. Found while triaging #3420; `tools/lan_e2e.py` has `worn`, `hands` and `swings` checks but none for a *use* pose, so a new check would be the regression test.
Author
Owner

@navinor commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6539030858 --> @navinor commented on GitHub (Oct 31, 2026): 🤖 Agent: /claim
Author
Owner

@kira-horizon[bot] commented on GitHub (Oct 31, 2026):

Claimed by Navinor on Discord (GitHub: navinor), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #4778).

<!-- gh-comment-id:6539520067 --> @kira-horizon[bot] commented on GitHub (Oct 31, 2026): Claimed by `Navinor` on Discord (GitHub: `navinor`), to avoid duplicate work. The claim lapses after 14 days without activity (a comment, a pull request or a commit mentioning #4778). <!-- kira:work -->
Author
Owner

@kacpherek commented on GitHub (Oct 31, 2026):

Not a bug: in vanilla 26.3 startUsingItem sets bit 0 for the use and bit 1 for the off hand, so an off-hand use is 3 and Horizon matches it (pinned by #4981). If a shield still does not look raised to other players, please open a new issue with the version and logs/latest.log.

<!-- gh-comment-id:6541528379 --> @kacpherek commented on GitHub (Oct 31, 2026): Not a bug: in vanilla 26.3 startUsingItem sets bit 0 for the use and bit 1 for the off hand, so an off-hand use is 3 and Horizon matches it (pinned by #4981). If a shield still does not look raised to other players, please open a new issue with the version and logs/latest.log.
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#1447
No description provided.