[PR #7651] A salmon's box follows its size variant #7737

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

📋 Pull Request Information

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

Base: main ← Head: fix/salmon-box-size


📝 Commits (3)

  • b6b2702 fix: a salmon's box follows its size variant
  • a6fa986 test: the box of each salmon variant
  • 13b7c33 port_map: Salmon.getDefaultDimensions

📊 Changes

3 files changed (+49 additions, -0 deletions)

View changed files

📝 crates/horizon-client/src/mobs/aquatic.rs (+42 -0)
📝 crates/horizon-client/src/mobs/living.rs (+6 -0)
📝 tools/port_map/game-011.tsv (+1 -0)

📄 Description

Vanilla

Salmon.getDefaultDimensions(Pose) is the fish box scaled by the variant's bounding box scale:

0: aload_0
1: invokevirtual #233  // AbstractSchoolingFish.getDefaultDimensions:(Lnet/minecraft/world/entity/Pose;)Lnet/minecraft/world/entity/EntityDimensions;
6: invokevirtual #237  // Salmon.getSalmonScale:()F
9: invokevirtual #241  // EntityDimensions.scale:(F)Lnet/minecraft/world/entity/EntityDimensions;
12: areturn

getSalmonScale() returns Salmon$Variant.boundingBoxScale (1: getVariant(); 4: getfield Salmon$Variant.boundingBoxScale), and the enum's static initialiser builds the three variants with 0.5f, fconst_1 and 1.5f:

 7: ldc  #45  // String small
10: ldc  #47  // float 0.5f
28: fconst_1
45: ldc  #57  // float 1.5f

EntityDimensions.scale(float) is scale(f, f), so width, height and eye height all follow the variant - a small salmon's box is half the medium one's, a large salmon's is half again.

Horizon

finalizeSpawn already picked the variant (small 30, medium 50, large 15) and the renderer draws salmon_small / salmon / salmon_large, but Mob::awake_dims_in had no salmon arm, so every salmon kept the type's medium box. A small salmon's hitbox, attack range and collision were twice its model, and a large salmon's were two thirds of it.

The box now goes through aquatic::salmon_scale, the variant's factor, at the end of awake_dims_in (so a baby salmon scales too, as super does in vanilla).

Proven:

  • cargo test -p horizon-client-lib --lib mobs::aquatic: 5 passed; 0 failed.
  • With the new arm removed, a_salmon_box_follows_its_variant fails with the values the fix supplies: left: (0.8999999761581421, 1.399999976158142, 1.2999999523162842) (the medium box a small salmon kept) against right: (0.44999998807907104, 0.699999988079071, 0.6499999761581421) (half of it).
  • cargo clippy -q -p horizon-client-lib --lib is silent; rustfmt --edition 2024 --check on both files is clean.

Not proven:

  • No in-game check that a caught small salmon (bucket or spawn egg, apply_item_components) shows the new box; the unit test sets the variant directly.
  • The carrier/vehicle and riding paths that read Mob::width/Mob::height are not covered beyond the dims themselves.

🔄 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/7651 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/salmon-box-size` --- ### 📝 Commits (3) - [`b6b2702`](https://github.com/horizon-rust/horizon/commit/b6b2702d3574420796bd3d3a926f560eaa9efcd5) fix: a salmon's box follows its size variant - [`a6fa986`](https://github.com/horizon-rust/horizon/commit/a6fa986bb64fa3534dc06ca0b269055597cf2feb) test: the box of each salmon variant - [`13b7c33`](https://github.com/horizon-rust/horizon/commit/13b7c339a419921d975640ed355607c740bd4b65) port_map: Salmon.getDefaultDimensions ### 📊 Changes **3 files changed** (+49 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/aquatic.rs` (+42 -0) 📝 `crates/horizon-client/src/mobs/living.rs` (+6 -0) 📝 `tools/port_map/game-011.tsv` (+1 -0) </details> ### 📄 Description ### Vanilla `Salmon.getDefaultDimensions(Pose)` is the fish box scaled by the variant's bounding box scale: ``` 0: aload_0 1: invokevirtual #233 // AbstractSchoolingFish.getDefaultDimensions:(Lnet/minecraft/world/entity/Pose;)Lnet/minecraft/world/entity/EntityDimensions; 6: invokevirtual #237 // Salmon.getSalmonScale:()F 9: invokevirtual #241 // EntityDimensions.scale:(F)Lnet/minecraft/world/entity/EntityDimensions; 12: areturn ``` `getSalmonScale()` returns `Salmon$Variant.boundingBoxScale` (`1: getVariant(); 4: getfield Salmon$Variant.boundingBoxScale`), and the enum's static initialiser builds the three variants with `0.5f`, `fconst_1` and `1.5f`: ``` 7: ldc #45 // String small 10: ldc #47 // float 0.5f 28: fconst_1 45: ldc #57 // float 1.5f ``` `EntityDimensions.scale(float)` is `scale(f, f)`, so width, height **and** eye height all follow the variant - a small salmon's box is half the medium one's, a large salmon's is half again. ### Horizon `finalizeSpawn` already picked the variant (small 30, medium 50, large 15) and the renderer draws `salmon_small` / `salmon` / `salmon_large`, but `Mob::awake_dims_in` had no salmon arm, so every salmon kept the type's medium box. A small salmon's hitbox, attack range and collision were twice its model, and a large salmon's were two thirds of it. The box now goes through `aquatic::salmon_scale`, the variant's factor, at the end of `awake_dims_in` (so a baby salmon scales too, as `super` does in vanilla). **Proven:** - `cargo test -p horizon-client-lib --lib mobs::aquatic`: `5 passed; 0 failed`. - With the new arm removed, `a_salmon_box_follows_its_variant` fails with the values the fix supplies: `left: (0.8999999761581421, 1.399999976158142, 1.2999999523162842)` (the medium box a small salmon kept) against `right: (0.44999998807907104, 0.699999988079071, 0.6499999761581421)` (half of it). - `cargo clippy -q -p horizon-client-lib --lib` is silent; `rustfmt --edition 2024 --check` on both files is clean. **Not proven:** - No in-game check that a caught small salmon (bucket or spawn egg, `apply_item_components`) shows the new box; the unit test sets the variant directly. - The carrier/vehicle and riding paths that read `Mob::width`/`Mob::height` are not covered beyond the dims themselves. --- <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#7737
No description provided.