[PR #3558] [MERGED] Draw the arms under a map held in first person #5049

Closed
opened 2026-11-03 05:09:52 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3558
Author: @d3grando
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: fix-3136


📝 Commits (1)

  • 2bb3903 Draw the arms under a map held in first person

📊 Changes

3 files changed (+232 additions, -80 deletions)

View changed files

📝 crates/horizon-client/src/first_person.rs (+164 -1)
📝 crates/horizon-client/src/game.rs (+64 -64)
📝 crates/horizon-client/src/game/maps.rs (+4 -15)

📄 Description

🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves.

What and why

Fixes #3136

In first person, a held map floated with no hands under it, whether it was held in one hand or in both. The code said so: two_handed_map_geometry was documented "the arms under it are not drawn", and the one-handed pose had the same gap.

Changes:

  • first_person::map_arm_poses(hold, left, pitch, inverse_height, attack) gives the poses of the arms under a map:
    • one-handed: the holding arm.
    • two-handed: the right arm, then the left.
    • hand_geometry draws them before the map, unless the player has Invisibility.
  • first_person::player_arm_pose (renderPlayerArm, mirrored for the left arm) and first_person::two_handed_map_base (the swing, calculateMapTilt and the tilt) moved into the lib. The empty hand and two_handed_map_geometry now use them instead of their own copies.
  • The game now loads both arms of the wide and slim player models (it kept only right_arm). The new Game::first_person_arm draws either one with the player's skin.

One small side effect on the empty hand: it now goes through the same first_person_arm, so it gets renderHand's zRot = 0.1 (the code before set it to 0). It also uses Mth.sin and the exact float constants (0.64000005f, -0.71999997f) instead of f32::sin and 0.64/0.72.

Vanilla reference

net.minecraft.client.renderer.FirstPersonHandsAndItemsRenderer (26.3, read with javap):

  • renderOneHandedMap: translate(f*0.125, -0.125, 0). Then, if !avatarRenderState.isInvisible: push, rotateDegrees(ZP, f*10), renderPlayerArm, pop.
  • renderTwoHandedMap: after the tilt rotation, if !isInvisible: push, rotateDegrees(YP, 90), renderMapHand(RIGHT), renderMapHand(LEFT), pop.
  • renderMapHand: YP 92, XP 45, ZP f*-41, translate(f*0.3, -1.1, 0.45), then renderPlayerHand.
  • renderPlayerArm: the swing translation, then YP f*45, YP f*sin(√a·π)*70, ZP f*sin(a²·π)*-20, translate(-f, 3.6, 3.5), ZP f*120, XP 200, YP f*-135, translate(f*5.6, 0, 0).
  • calculateMapTilt.
  • AvatarRenderer.renderHand: arm.resetPose(), leftArm.zRot = -0.1, rightArm.zRot = 0.1.

No harness covers first-person geometry (tools/test_first_person_parity.py checks the hand's tick state, such as swings and equip heights, not the render poses). The expected matrices in the new test come from replaying those PoseStack calls with vanilla's own PoseStack, Axis and Mth from the 26.3 client jar (a small Java program, not committed), the same way the existing one_handed_maps_follow_render_one_handed_map values were made.

Self-check

tools/pr_ready.py was not run (Windows). These are the commands I ran:

cargo fmt --all -- --check                                              # ok
cargo clippy -p horizon-client --features mods --all-targets -- -D warnings   # ok
cargo test -p horizon-client --lib first_person::                       # 14 passed

The new test is first_person::item_pose_tests::maps_draw_the_arms_under_them_as_vanilla. It checks one arm for three one-handed cases (right and left, with swing and lowered heights), and two arms, right then left, for two two-handed cases (pitch 0 and 30). Each arm's matrix must match vanilla to 1e-5.

Before (map_arm_poses returning no arms, as the game drew):

test first_person::item_pose_tests::maps_draw_the_arms_under_them_as_vanilla ... FAILED
assertion `left == right` failed: one arm under a one-handed map
  left: 0
 right: 1
test result: FAILED. 0 passed; 1 failed

After:

test first_person::item_pose_tests::maps_draw_the_arms_under_them_as_vanilla ... ok
test first_person::item_pose_tests::one_handed_maps_follow_render_one_handed_map ... ok
test result: ok. 14 passed; 0 failed

Screenshots

Checked in game with a filled map in the main hand, in a creative world (screenshots not attached):

  • Before (v0.2.97), two-handed: the map with no arms.
  • Before (v0.2.97), one-handed (torch in the off hand): the map with no arm.
  • After, two-handed looking down: both arms come up from the bottom of the screen to the map's lower corners.
  • After, one-handed: the arm under the map at the bottom right.
  • After, with Invisibility: no arms, as vanilla.
  • After, empty hand for comparison (the same skin).

🤖 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/3558 **Author:** [@d3grando](https://github.com/d3grando) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `fix-3136` --- ### 📝 Commits (1) - [`2bb3903`](https://github.com/horizon-rust/horizon/commit/2bb3903b49d0d571188e842657d041423f6f4fdb) Draw the arms under a map held in first person ### 📊 Changes **3 files changed** (+232 additions, -80 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/first_person.rs` (+164 -1) 📝 `crates/horizon-client/src/game.rs` (+64 -64) 📝 `crates/horizon-client/src/game/maps.rs` (+4 -15) </details> ### 📄 Description > 🤖 Opened by d3grando's AI agent (Claude Code, Claude Opus 5.5), not by d3grando themselves. ## What and why Fixes #3136 In first person, a held map floated with no hands under it, whether it was held in one hand or in both. The code said so: `two_handed_map_geometry` was documented "the arms under it are not drawn", and the one-handed pose had the same gap. Changes: - `first_person::map_arm_poses(hold, left, pitch, inverse_height, attack)` gives the poses of the arms under a map: - one-handed: the holding arm. - two-handed: the right arm, then the left. - `hand_geometry` draws them before the map, unless the player has Invisibility. - `first_person::player_arm_pose` (`renderPlayerArm`, mirrored for the left arm) and `first_person::two_handed_map_base` (the swing, `calculateMapTilt` and the tilt) moved into the lib. The empty hand and `two_handed_map_geometry` now use them instead of their own copies. - The game now loads both arms of the wide and slim player models (it kept only `right_arm`). The new `Game::first_person_arm` draws either one with the player's skin. One small side effect on the empty hand: it now goes through the same `first_person_arm`, so it gets `renderHand`'s `zRot = 0.1` (the code before set it to 0). It also uses `Mth.sin` and the exact float constants (`0.64000005f`, `-0.71999997f`) instead of `f32::sin` and `0.64`/`0.72`. ## Vanilla reference `net.minecraft.client.renderer.FirstPersonHandsAndItemsRenderer` (26.3, read with javap): - `renderOneHandedMap`: `translate(f*0.125, -0.125, 0)`. Then, if `!avatarRenderState.isInvisible`: push, `rotateDegrees(ZP, f*10)`, `renderPlayerArm`, pop. - `renderTwoHandedMap`: after the tilt rotation, if `!isInvisible`: push, `rotateDegrees(YP, 90)`, `renderMapHand(RIGHT)`, `renderMapHand(LEFT)`, pop. - `renderMapHand`: `YP 92`, `XP 45`, `ZP f*-41`, `translate(f*0.3, -1.1, 0.45)`, then `renderPlayerHand`. - `renderPlayerArm`: the swing translation, then `YP f*45`, `YP f*sin(√a·π)*70`, `ZP f*sin(a²·π)*-20`, `translate(-f, 3.6, 3.5)`, `ZP f*120`, `XP 200`, `YP f*-135`, `translate(f*5.6, 0, 0)`. - `calculateMapTilt`. - `AvatarRenderer.renderHand`: `arm.resetPose()`, `leftArm.zRot = -0.1`, `rightArm.zRot = 0.1`. No harness covers first-person geometry (`tools/test_first_person_parity.py` checks the hand's tick state, such as swings and equip heights, not the render poses). The expected matrices in the new test come from replaying those `PoseStack` calls with vanilla's own `PoseStack`, `Axis` and `Mth` from the 26.3 client jar (a small Java program, not committed), the same way the existing `one_handed_maps_follow_render_one_handed_map` values were made. ## Self-check `tools/pr_ready.py` was not run (Windows). These are the commands I ran: ``` cargo fmt --all -- --check # ok cargo clippy -p horizon-client --features mods --all-targets -- -D warnings # ok cargo test -p horizon-client --lib first_person:: # 14 passed ``` The new test is `first_person::item_pose_tests::maps_draw_the_arms_under_them_as_vanilla`. It checks one arm for three one-handed cases (right and left, with swing and lowered heights), and two arms, right then left, for two two-handed cases (pitch 0 and 30). Each arm's matrix must match vanilla to 1e-5. Before (`map_arm_poses` returning no arms, as the game drew): ``` test first_person::item_pose_tests::maps_draw_the_arms_under_them_as_vanilla ... FAILED assertion `left == right` failed: one arm under a one-handed map left: 0 right: 1 test result: FAILED. 0 passed; 1 failed ``` After: ``` test first_person::item_pose_tests::maps_draw_the_arms_under_them_as_vanilla ... ok test first_person::item_pose_tests::one_handed_maps_follow_render_one_handed_map ... ok test result: ok. 14 passed; 0 failed ``` ## Screenshots Checked in game with a filled map in the main hand, in a creative world (screenshots not attached): - Before (v0.2.97), two-handed: the map with no arms. - Before (v0.2.97), one-handed (torch in the off hand): the map with no arm. - After, two-handed looking down: both arms come up from the bottom of the screen to the map's lower corners. - After, one-handed: the arm under the map at the bottom right. - After, with Invisibility: no arms, as vanilla. - After, empty hand for comparison (the same skin). 🤖 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 05:09:52 +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#5049
No description provided.