[PR #7618] A rearing polar bear's box grows with its stand animation #7717

Open
opened 2026-11-03 07:22:40 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7618
Author: @MSedgeMC
Created: 11/2/2026
Status: 🔄 Open

Base: main ← Head: fix/polar-bear-stand-box


📝 Commits (3)

  • 430b86d fix: a rearing polar bear's box grows with its stand animation
  • 4cab74e test: the box of a rearing polar bear
  • dc40732 port_map: PolarBear.getDefaultDimensions is ported

📊 Changes

3 files changed (+83 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/mobs/living.rs (+7 -0)
📝 crates/horizon-client/src/mobs/polar_bear.rs (+75 -0)
📝 tools/port_map/game-013.tsv (+1 -1)

📄 Description

Vanilla

PolarBear.getDefaultDimensions(Pose) (javap -p -c -constants -cp ... net.minecraft.world.entity.animal.polarbear.PolarBear) takes BABY_DIMENSIONS for a cub, else Animal.getDefaultDimensions(pose), and then:

19: getfield      #303  // Field clientSideStandAnimation:F
25: ifle          49
28: getfield      #303  // clientSideStandAnimation
32: ldc           #80   // float 6.0f
35: fdiv
36: fconst_1
37: fload_3
38: fadd
41: aload_2
45: invokevirtual #336  // EntityDimensions.scale:(FF)Lnet/minecraft/world/entity/EntityDimensions;
49: aload_2
50: areturn

EntityDimensions.scale(float, float) multiplies the width by the first factor and both the height and the eye height by the second (35: getfield height; fload_2; fmul, 41: getfield eyeHeight; fload_2; fmul). PolarBear.tick refreshes the box whenever the animation moved (26: invokevirtual refreshDimensions) and steps the animation by one per tick to Mth.clamp(animation +/- 1, 0, 6).

So a bear at full rear-up has a box twice as tall as its resting one, with its eyes twice as high, and the same width; at half the animation it is half again as tall.

Horizon

Mob::awake_dims_in has arms for the sleeping villager, the sniffer digging, the goat's long jump, a sitting camel, the warden digging, a puffed pufferfish, the phantom and slime sizes - none for the polar bear. A rearing bear kept the type's box, so a bear standing at twice its resting height could only be clicked, hit and picked up to its resting height, and its shadow and hitbox lagged the model.

The box now goes through polar_bear::stand_box_scale, the same 1 + animation / 6 factor, at the end of awake_dims_in.

Proven:

  • cargo test -p horizon-client-lib --lib polar_bear: 2 passed; 0 failed.
  • With the new arm removed, the same tests fail with the values the fix supplies:
    • a_rearing_bears_box_grows_taller_but_not_wider: left: 1.399999976158142, right: 2.0999999046325684 (three ticks, so half the animation: 1.4 -> 2.1; the full animation asserts 2.8).
    • the_box_follows_the_animation_and_not_the_flag: left: 1.399999976158142, right: 1.6333332061767578 (one tick: 1.4 x 7/6).
  • cargo clippy -q -p horizon-client-lib --lib is silent; rustfmt --edition 2024 --check on both files is clean.

Not proven:

  • Vanilla advances clientSideStandAnimation only on the client (PolarBear.tick guards the animation with level().isClientSide()), while Horizon runs polar_bear::client_tick from the shared AI step, so the box also grows on the simulating side. No harness covers the server-side hitbox of a rearing bear, so that divergence is left as it was.
  • No in-game check that a bear's click box matches its model; the unit test pins Mob::dims only.

🔄 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/7618 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/polar-bear-stand-box` --- ### 📝 Commits (3) - [`430b86d`](https://github.com/horizon-rust/horizon/commit/430b86d7d7f25cecc0a52392614230f6c78a284c) fix: a rearing polar bear's box grows with its stand animation - [`4cab74e`](https://github.com/horizon-rust/horizon/commit/4cab74eb25e157deb5b0e10be95c571a32ae2c71) test: the box of a rearing polar bear - [`dc40732`](https://github.com/horizon-rust/horizon/commit/dc4073266eaf6e22eabdc049d72cd07ed244a6f9) port_map: PolarBear.getDefaultDimensions is ported ### 📊 Changes **3 files changed** (+83 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/living.rs` (+7 -0) 📝 `crates/horizon-client/src/mobs/polar_bear.rs` (+75 -0) 📝 `tools/port_map/game-013.tsv` (+1 -1) </details> ### 📄 Description ### Vanilla `PolarBear.getDefaultDimensions(Pose)` (`javap -p -c -constants -cp ... net.minecraft.world.entity.animal.polarbear.PolarBear`) takes `BABY_DIMENSIONS` for a cub, else `Animal.getDefaultDimensions(pose)`, and then: ``` 19: getfield #303 // Field clientSideStandAnimation:F 25: ifle 49 28: getfield #303 // clientSideStandAnimation 32: ldc #80 // float 6.0f 35: fdiv 36: fconst_1 37: fload_3 38: fadd 41: aload_2 45: invokevirtual #336 // EntityDimensions.scale:(FF)Lnet/minecraft/world/entity/EntityDimensions; 49: aload_2 50: areturn ``` `EntityDimensions.scale(float, float)` multiplies the width by the first factor and **both the height and the eye height** by the second (`35: getfield height; fload_2; fmul`, `41: getfield eyeHeight; fload_2; fmul`). `PolarBear.tick` refreshes the box whenever the animation moved (`26: invokevirtual refreshDimensions`) and steps the animation by one per tick to `Mth.clamp(animation +/- 1, 0, 6)`. So a bear at full rear-up has a box twice as tall as its resting one, with its eyes twice as high, and the same width; at half the animation it is half again as tall. ### Horizon `Mob::awake_dims_in` has arms for the sleeping villager, the sniffer digging, the goat's long jump, a sitting camel, the warden digging, a puffed pufferfish, the phantom and slime sizes - none for the polar bear. A rearing bear kept the type's box, so a bear standing at twice its resting height could only be clicked, hit and picked up to its resting height, and its shadow and hitbox lagged the model. The box now goes through `polar_bear::stand_box_scale`, the same `1 + animation / 6` factor, at the end of `awake_dims_in`. **Proven:** - `cargo test -p horizon-client-lib --lib polar_bear`: `2 passed; 0 failed`. - With the new arm removed, the same tests fail with the values the fix supplies: - `a_rearing_bears_box_grows_taller_but_not_wider`: `left: 1.399999976158142, right: 2.0999999046325684` (three ticks, so half the animation: 1.4 -> 2.1; the full animation asserts 2.8). - `the_box_follows_the_animation_and_not_the_flag`: `left: 1.399999976158142, right: 1.6333332061767578` (one tick: 1.4 x 7/6). - `cargo clippy -q -p horizon-client-lib --lib` is silent; `rustfmt --edition 2024 --check` on both files is clean. **Not proven:** - Vanilla advances `clientSideStandAnimation` only on the client (`PolarBear.tick` guards the animation with `level().isClientSide()`), while Horizon runs `polar_bear::client_tick` from the shared AI step, so the box also grows on the simulating side. No harness covers the server-side hitbox of a rearing bear, so that divergence is left as it was. - No in-game check that a bear's click box matches its model; the unit test pins `Mob::dims` only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#7717
No description provided.