[PR #2807] [MERGED] The shield goes up in first person and the other players hold it up (fixes #2289) #4627

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

📋 Pull Request Information

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

Base: main ← Head: fix/shield-blocking-pose


📝 Commits (4)

  • b85ce82 Merge kacpherek's PR #2310: the shield goes up in first person and other players show the blocking pose
  • 0b4fa47 Test the shield's blocking pose and its use duration
  • 826147d Merge upstream/main into fix/shield-blocking-pose
  • e9c6751 Merge main into fix/shield-blocking-pose

📊 Changes

2 files changed (+84 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/game/item_draw.rs (+24 -0)
📝 crates/horizon-client/src/mobs/anim.rs (+60 -0)

📄 Description

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

What and why

A shield's use animation is the BLOCK one: AvatarRenderer.getArmPose raises the arm for it and Item.getUseDuration gives it 72000 ticks, so the arm stays up while the shield is used. Horizon never raised the arm for another player holding a shield, and it gave the shield no use duration at all, so there was no shield animation to show (#2289).

This pull request merges kacpherek's PR #2310 as it is (with its authorship) and adds the tests it lacked:

  • the other players' blocking flag now follows the used item's blocks_attacks component (the vanilla's rule for the BLOCK use animation) in game/lan.rs and game/remote.rs, so a player raising a shield holds the arm up;
  • the shield's use duration is the vanilla's 72000 ticks (Item.getUseDuration), so the first-person use animation runs instead of ending at once;
  • the new tests pin both ends: the arm goes across the body while the shield is used, and the shield's use duration is 72000 and not the 0 an item without an use animation gets.

Fixes #2289

Vanilla reference

  • net.minecraft.client.renderer.entity.player.AvatarRenderer.getArmPose - the used hand's item's use animation decides the arm's pose; ItemUseAnimation.BLOCK gives HumanoidModel.ArmPose.BLOCK (and the other hand keeps its own pose).
  • net.minecraft.world.item.Item.getUseAnimation - an item with the minecraft:blocks_attacks component (a shield) uses the BLOCK animation.
  • net.minecraft.world.item.Item.getUseDuration - the consumable's ticks for food, 72000 for an item with blocks_attacks (or kinetic_weapon), 0 otherwise.
  • net.minecraft.client.model.HumanoidModel.poseBlockingArm - the BLOCK pose: the arm at -0.9424779F radians, turned -PI / 6 to the side (plus the head's own rotation, clamped).
  • net.minecraft.client.renderer.FirstPersonHandsAndItemsRenderer - the first-person hand: the item's use animation runs while the item is used, and Item.getUseDuration is how long it runs.

Self-check

pr_ready (tools/pr_ready.py --quick --base upstream/main on cachyos-x8664, against upstream/main at 1e3a9d53a, 5 min 31 s)

Check Result
Scope ✅ 4 files, +115 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 336 passed (18 s)
rustfmt ✅ (5 s)
clippy ✅ (1 min 28 s)
tests: horizon-client ✅ 1331 passed (2 min 30 s)
doc tests ✅ 0 passed (1 min 3 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 74 affected, to run in CI (--quick): arrow, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, breaking_model, cauldron, command_exec, composter, crafter and 62 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

The clippy row is red on upstream's own code, not on this branch: the 14 collapsible_if lints are in crates/horizon-world/src/datafix/*, which this pull request does not touch, and the same 14 appear on a pristine upstream/main with this toolchain (rustc 1.95.0). The CI's verify job on this pull request is green.

  • cargo test --locked -p horizon-client --lib -- a_raised_shield -> 1 passed (mobs::anim::flight_pose_tests::a_raised_shield_holds_the_arm_across_the_body).
  • cargo test --locked -p horizon-client --bin horizon-client -- a_shield_is_used -> 1 passed (game::item_draw::tests::a_shield_is_used_for_the_vanilla_s_time).
  • Negative control: with the blocks_attacks case taken out of use_duration, the new test fails - assertion 'left == right' failed with left: 0, right: 72000, the shield's use animation would end at once.
  • cargo fmt -p horizon-client -> no changes.

🤖 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/2807 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/shield-blocking-pose` --- ### 📝 Commits (4) - [`b85ce82`](https://github.com/horizon-rust/horizon/commit/b85ce82160531f8cac5e1ec30ede0c46bd48d157) Merge kacpherek's PR #2310: the shield goes up in first person and other players show the blocking pose - [`0b4fa47`](https://github.com/horizon-rust/horizon/commit/0b4fa473e7a1ae7b375cff1791fe6cd923e403c7) Test the shield's blocking pose and its use duration - [`826147d`](https://github.com/horizon-rust/horizon/commit/826147d7163788bade56df2283d136fc37eee7a5) Merge upstream/main into fix/shield-blocking-pose - [`e9c6751`](https://github.com/horizon-rust/horizon/commit/e9c6751a1b600f4d7e7dceef5aa149321c311bb2) Merge main into fix/shield-blocking-pose ### 📊 Changes **2 files changed** (+84 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/item_draw.rs` (+24 -0) 📝 `crates/horizon-client/src/mobs/anim.rs` (+60 -0) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code), not by levzzz5154 himself. ## What and why A shield's use animation is the BLOCK one: `AvatarRenderer.getArmPose` raises the arm for it and `Item.getUseDuration` gives it 72000 ticks, so the arm stays up while the shield is used. Horizon never raised the arm for another player holding a shield, and it gave the shield no use duration at all, so there was no shield animation to show (#2289). This pull request merges kacpherek's PR #2310 as it is (with its authorship) and adds the tests it lacked: - the other players' `blocking` flag now follows the used item's `blocks_attacks` component (the vanilla's rule for the BLOCK use animation) in `game/lan.rs` and `game/remote.rs`, so a player raising a shield holds the arm up; - the shield's use duration is the vanilla's 72000 ticks (`Item.getUseDuration`), so the first-person use animation runs instead of ending at once; - the new tests pin both ends: the arm goes across the body while the shield is used, and the shield's use duration is 72000 and not the 0 an item without an use animation gets. Fixes #2289 ## Vanilla reference - `net.minecraft.client.renderer.entity.player.AvatarRenderer.getArmPose` - the used hand's item's use animation decides the arm's pose; `ItemUseAnimation.BLOCK` gives `HumanoidModel.ArmPose.BLOCK` (and the other hand keeps its own pose). - `net.minecraft.world.item.Item.getUseAnimation` - an item with the `minecraft:blocks_attacks` component (a shield) uses the BLOCK animation. - `net.minecraft.world.item.Item.getUseDuration` - the consumable's ticks for food, 72000 for an item with `blocks_attacks` (or `kinetic_weapon`), 0 otherwise. - `net.minecraft.client.model.HumanoidModel.poseBlockingArm` - the BLOCK pose: the arm at `-0.9424779F` radians, turned `-PI / 6` to the side (plus the head's own rotation, clamped). - `net.minecraft.client.renderer.FirstPersonHandsAndItemsRenderer` - the first-person hand: the item's use animation runs while the item is used, and `Item.getUseDuration` is how long it runs. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on cachyos-x8664, against upstream/main at 1e3a9d53a, 5 min 31 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +115 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 336 passed (18 s) | | rustfmt | ✅ (5 s) | | clippy | ✅ (1 min 28 s) | | tests: horizon-client | ✅ 1331 passed (2 min 30 s) | | doc tests | ✅ 0 passed (1 min 3 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 74 affected, to run in CI (--quick): arrow, auto_jump, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal, breaking_model, cauldron, command_exec, composter, crafter and 62 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | The clippy row is red on upstream's own code, not on this branch: the 14 `collapsible_if` lints are in `crates/horizon-world/src/datafix/*`, which this pull request does not touch, and the same 14 appear on a pristine `upstream/main` with this toolchain (rustc 1.95.0). The CI's `verify` job on this pull request is green. - `cargo test --locked -p horizon-client --lib -- a_raised_shield` -> `1 passed` (`mobs::anim::flight_pose_tests::a_raised_shield_holds_the_arm_across_the_body`). - `cargo test --locked -p horizon-client --bin horizon-client -- a_shield_is_used` -> `1 passed` (`game::item_draw::tests::a_shield_is_used_for_the_vanilla_s_time`). - Negative control: with the `blocks_attacks` case taken out of `use_duration`, the new test fails - `assertion 'left == right' failed` with `left: 0, right: 72000`, the shield's use animation would end at once. - `cargo fmt -p horizon-client` -> no changes. 🤖 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:06:46 +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#4627
No description provided.