[PR #314] [MERGED] Show the off-hand item in first person #2482

Closed
opened 2026-11-02 15:56:34 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: fix/offhand-render


📝 Commits (3)

  • ffd0297 Crossbows load firework rockets from either hand; bows and crossbows take held arrows first
  • 5e29357 Use the off hand when the main hand passes: place blocks, eat, charge anchors
  • 64739d2 Show the off-hand item in first person

📊 Changes

21 files changed (+549 additions, -318 deletions)

View changed files

📝 crates/horizon-client/src/first_person.rs (+52 -1)
📝 crates/horizon-client/src/game.rs (+267 -191)
📝 crates/horizon-client/src/game/armor_stands.rs (+2 -2)
📝 crates/horizon-client/src/game/books.rs (+2 -2)
📝 crates/horizon-client/src/game/creatures.rs (+4 -4)
📝 crates/horizon-client/src/game/crossbow.rs (+120 -32)
📝 crates/horizon-client/src/game/dispense_fixture.rs (+16 -8)
📝 crates/horizon-client/src/game/dispenser.rs (+1 -1)
📝 crates/horizon-client/src/game/fireworks.rs (+3 -2)
📝 crates/horizon-client/src/game/fov.rs (+1 -1)
📝 crates/horizon-client/src/game/hand.rs (+28 -7)
📝 crates/horizon-client/src/game/maps.rs (+1 -1)
📝 crates/horizon-client/src/game/potions.rs (+7 -7)
📝 crates/horizon-client/src/game/powder_snow.rs (+1 -1)
📝 crates/horizon-client/src/game/raids.rs (+2 -2)
📝 crates/horizon-client/src/game/respawn_anchor.rs (+3 -28)
📝 crates/horizon-client/src/game/shield.rs (+1 -5)
📝 crates/horizon-client/src/game/trident.rs (+5 -5)
📝 crates/horizon-client/src/game/wind.rs (+2 -2)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java (+20 -15)

...and 1 more files

📄 Description

Fixes #276. Thanks to Cosmic (Online5277) for the report. Stacked on #313: review only the top commit.

What

The off-hand item now shows in first person.

Why

FirstPersonHandsAndItemsRenderer.submitHandsWithItems draws both hands. The off hand sits on the other arm, with its own equip height and swing, and with the use pose (eating, blocking, drawing) only when it is the hand in use. FirstPersonHandsAndItems.evaluateWhichHandsToRender hides a hand while a bow or crossbow is drawn, or while a charged crossbow is in the main hand. The empty arm is drawn only for the main hand. Horizon drew only the main hand.

How

  • first_person::hands_to_render implements evaluateWhichHandsToRender, with a unit test.
  • hand_geometry loops over both hands, with per-hand attack (the swinging hand), inverse height, arm side (main_hand_left) and display context and seed (FIRST_PERSON_LEFT/RIGHT_HAND). The use pose applies only to the hand in use. Only the main hand turns a charged crossbow aside.
  • Game::used_hand (getUsedItemHand).

Third person already drew the off-hand item and arm pose: checked in game (tp-front-sword-shield.png). Its code is unchanged.

Not covered yet: a one-handed map (map in the main hand with something in the off hand) still draws as a flat item. The left arm isn't drawn when the main hand is set to left. Both were like this before.

How tested

  • Unit test drawing_a_bow_or_holding_a_charged_crossbow_hides_a_hand.
  • Screenshots (Mac mini, offscreen):
    • sword and off-hand shield (fp-sword-shield.png);
    • the shield raised from the off hand (fp-shield-raised.png);
    • empty main hand: arm plus the off-hand block (fp-empty-main-offhand-block.png);
    • charged crossbow hiding the off hand (fp-crossbow-charged-rocket.png);
    • third person (tp-front-sword-shield.png).
  • There is no pose harness for the first-person renderer. The first_person harness covers the swing and equip-height logic.
Self-check (Mac mini), all five branches of this batch rebased on origin/main 050b2038:
- cargo fmt --all --check: OK
- cargo clippy --workspace --all-targets -- -D warnings: OK on this branch alone, and on the integration of all five
- cargo test -p horizon-client (integration): 649 + 41 + 15 + 2 + 2 + 1 passed, 0 failed
- tools/parity.py --changed origin/main on the integration commit: 79 passed, 0 failed
  (including arrow, use_item_on, first_person, dispenser and mob_ai)
- tools/parity.py, run explicitly: player_hurt, blocking_rules, blocking_item_damage, item_use, item_use_start,
  item_use_lifecycle, living_hurt, damage_reduction, player_equipment, registered_player_combat,
  server_player_combat, server_player_damage: 12 passed, 0 failed

Screenshots: ~/code/horizon-parity/shots/offhand-276/ on the Mac mini.

Needs Ludovic

A look at the screenshots (~/code/horizon-parity/shots/offhand-276/ on the Mac mini), to judge the off-hand placement by eye against vanilla.

🤖 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/314 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/offhand-render` --- ### 📝 Commits (3) - [`ffd0297`](https://github.com/horizon-rust/horizon/commit/ffd0297dc421e499c7567e4602d91e5fe652a1b9) Crossbows load firework rockets from either hand; bows and crossbows take held arrows first - [`5e29357`](https://github.com/horizon-rust/horizon/commit/5e2935747bca16333b9d048fd67f0ca6c90a92c8) Use the off hand when the main hand passes: place blocks, eat, charge anchors - [`64739d2`](https://github.com/horizon-rust/horizon/commit/64739d2b8b0ceadd7b08420419e7b84c2fd35cfb) Show the off-hand item in first person ### 📊 Changes **21 files changed** (+549 additions, -318 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/first_person.rs` (+52 -1) 📝 `crates/horizon-client/src/game.rs` (+267 -191) 📝 `crates/horizon-client/src/game/armor_stands.rs` (+2 -2) 📝 `crates/horizon-client/src/game/books.rs` (+2 -2) 📝 `crates/horizon-client/src/game/creatures.rs` (+4 -4) 📝 `crates/horizon-client/src/game/crossbow.rs` (+120 -32) 📝 `crates/horizon-client/src/game/dispense_fixture.rs` (+16 -8) 📝 `crates/horizon-client/src/game/dispenser.rs` (+1 -1) 📝 `crates/horizon-client/src/game/fireworks.rs` (+3 -2) 📝 `crates/horizon-client/src/game/fov.rs` (+1 -1) 📝 `crates/horizon-client/src/game/hand.rs` (+28 -7) 📝 `crates/horizon-client/src/game/maps.rs` (+1 -1) 📝 `crates/horizon-client/src/game/potions.rs` (+7 -7) 📝 `crates/horizon-client/src/game/powder_snow.rs` (+1 -1) 📝 `crates/horizon-client/src/game/raids.rs` (+2 -2) 📝 `crates/horizon-client/src/game/respawn_anchor.rs` (+3 -28) 📝 `crates/horizon-client/src/game/shield.rs` (+1 -5) 📝 `crates/horizon-client/src/game/trident.rs` (+5 -5) 📝 `crates/horizon-client/src/game/wind.rs` (+2 -2) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java` (+20 -15) _...and 1 more files_ </details> ### 📄 Description Fixes #276. Thanks to Cosmic (Online5277) for the report. Stacked on #313: review only the top commit. ## What The off-hand item now shows in first person. ## Why `FirstPersonHandsAndItemsRenderer.submitHandsWithItems` draws both hands. The off hand sits on the other arm, with its own equip height and swing, and with the use pose (eating, blocking, drawing) only when it is the hand in use. `FirstPersonHandsAndItems.evaluateWhichHandsToRender` hides a hand while a bow or crossbow is drawn, or while a charged crossbow is in the main hand. The empty arm is drawn only for the main hand. Horizon drew only the main hand. ## How - `first_person::hands_to_render` implements `evaluateWhichHandsToRender`, with a unit test. - `hand_geometry` loops over both hands, with per-hand attack (the swinging hand), inverse height, arm side (`main_hand_left`) and display context and seed (`FIRST_PERSON_LEFT/RIGHT_HAND`). The use pose applies only to the hand in use. Only the main hand turns a charged crossbow aside. - `Game::used_hand` (`getUsedItemHand`). Third person already drew the off-hand item and arm pose: checked in game (`tp-front-sword-shield.png`). Its code is unchanged. Not covered yet: a one-handed map (map in the main hand with something in the off hand) still draws as a flat item. The left arm isn't drawn when the main hand is set to left. Both were like this before. ## How tested - Unit test `drawing_a_bow_or_holding_a_charged_crossbow_hides_a_hand`. - Screenshots (Mac mini, offscreen): - sword and off-hand shield (`fp-sword-shield.png`); - the shield raised from the off hand (`fp-shield-raised.png`); - empty main hand: arm plus the off-hand block (`fp-empty-main-offhand-block.png`); - charged crossbow hiding the off hand (`fp-crossbow-charged-rocket.png`); - third person (`tp-front-sword-shield.png`). - There is no pose harness for the first-person renderer. The `first_person` harness covers the swing and equip-height logic. ``` Self-check (Mac mini), all five branches of this batch rebased on origin/main 050b2038: - cargo fmt --all --check: OK - cargo clippy --workspace --all-targets -- -D warnings: OK on this branch alone, and on the integration of all five - cargo test -p horizon-client (integration): 649 + 41 + 15 + 2 + 2 + 1 passed, 0 failed - tools/parity.py --changed origin/main on the integration commit: 79 passed, 0 failed (including arrow, use_item_on, first_person, dispenser and mob_ai) - tools/parity.py, run explicitly: player_hurt, blocking_rules, blocking_item_damage, item_use, item_use_start, item_use_lifecycle, living_hurt, damage_reduction, player_equipment, registered_player_combat, server_player_combat, server_player_damage: 12 passed, 0 failed ``` Screenshots: ~/code/horizon-parity/shots/offhand-276/ on the Mac mini. ## Needs Ludovic A look at the screenshots (`~/code/horizon-parity/shots/offhand-276/` on the Mac mini), to judge the off-hand placement by eye against vanilla. 🤖 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-02 15:56:34 +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#2482
No description provided.