[PR #7868] Every living entity's model follows minecraft:scale #7874

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

📋 Pull Request Information

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

Base: main ← Head: fix/living-model-scale


📝 Commits (6)

  • 1503bf9 fix: scale every living entity's box and eye height by minecraft:scale
  • f29cd0c test: a cow's 0.9 x 1.4 box at minecraft:scale 2 is 1.8 x 2.8
  • d631761 port_map: LivingEntity.getDimensions and getScale rows
  • cd9e24f Format the scale dimensions change
  • 88c9e56 Every living entity's model follows minecraft:scale
  • 2ae5efe A scaled sleeping avatar's bed offset uses its scaled eye height

📊 Changes

7 files changed (+265 additions, -54 deletions)

View changed files

📝 crates/horizon-client/src/game/remote.rs (+4 -3)
📝 crates/horizon-client/src/mobs.rs (+4 -3)
📝 crates/horizon-client/src/mobs/living.rs (+117 -9)
📝 crates/horizon-client/src/mobs/render.rs (+128 -19)
📝 crates/horizon-client/src/mobs/riders.rs (+8 -13)
📝 crates/horizon-client/src/shadows.rs (+1 -6)
📝 tools/port_map/game-006.tsv (+3 -1)

📄 Description

Depends on #7844 (fix/scale-dims), which carries the shared commits df52bce5c, 507a23ff4, 48474b4c5 and dc219db84; this PR is the renderer half its body leaves out, and those commits disappear from the diff when #7844 merges.

Why

From the 26.3 jar, LivingEntityRenderer.submit is, in order:

if (state.hasPose(Pose.SLEEPING) && state.bedOrientation != null)
    poseStack.translate(-stepX * (state.eyeHeight - 0.1f), 0, -stepZ * (state.eyeHeight - 0.1f));
float scale = state.scale;
poseStack.scale(scale, scale, scale);
this.setupRotations(state, poseStack, state.bodyRot, scale);
poseStack.scale(-1.0f, -1.0f, 1.0f);
this.scale(state, poseStack);
poseStack.translate(0.0f, -1.501f, 0.0f);

state.scale is LivingEntity.getScale(), so every living entity's model takes minecraft:scale, not only the avatar's. Horizon had it only in species_scale's avatar branch. #7844 gave every box and eye height the scale; this gives the model the same factor, in the same place.

The order matters: the sleeping translate is emitted before the scale, so a scaled sleeper's bed offset must not grow. Putting the uniform scale at the end (or anywhere before the sleep translate) gets this wrong, and a later placement also leaves setupRotations's own translations (the drowned's mid-box tip, the pufferfish bob, the avatar's swim offset) unscaled. base_transform_at now splits the bed offset out, then applies Mob::model_scale(), then pufferfish_bob + rotations, mirror, species scale() and the -1.501 translate. The avatar branch keeps only AvatarRenderer.scale's 0.9375.

The sleeping offset is getEyeHeight(Pose.STANDING) - 0.1, and LivingEntity.getEyeHeight goes through getDimensions, so the standing eye height carries minecraft:scale on an avatar too. The avatar branch used the type's 1.62 and put a scale-2 sleeper at the scale-1 distance from the pillow; it now multiplies by Mob::model_scale(), as the non-avatar branch's awake_dims already did.

Values

A sleeping villager (eyeHeight 1.62, minecraft:scale 2, facing north), bed-relative pose matrix after removing the bed offset, compared with twice the unscaled pose:

diagonal bed translation z
without this change (no uniform scale on a villager) 1.0 -1.501
uniform scale before the sleeping offset 2.0 0.138
with this change (expected) 2.0 -3.002

A sleeping avatar (0.9375 model, standing eye height 1.62, minecraft:scale 2), same comparison: the final z was -4.4343753 with the type's unscaled eye height; the scaled eye height gives -2.8143752. The diagonal is 1.875 (0.9375 x 2) in both.

An avatar at minecraft:scale 2: 1.875 times the model, not 3.75; the duplicate factor read 3.75 before the avatar branch dropped it. No window or GPU is needed: the tests assert matrices from base_transform_at.

Tests

  • cargo test -q -p horizon-client-lib --lib mobs::render - 31 passed, 1 ignored.
  • cargo test -q -p horizon-client-lib --lib - 1447 passed, 48 ignored.
  • cargo test -q -p horizon-client-render --lib - 1174 passed, 38 ignored.
  • cargo clippy -q -p horizon-client-lib --lib --all-targets -- -D warnings clean.
  • cargo fmt --all -- --check clean.

New tests: mobs::render::random_texture_tests::a_scaled_sleepers_bed_offset_is_not_scaled, a_scaled_sleeping_avatar_uses_its_scaled_eye_height and an_avatar_at_scale_two_scales_its_model_once.


🔄 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/7868 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 11/2/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/living-model-scale` --- ### 📝 Commits (6) - [`1503bf9`](https://github.com/horizon-rust/horizon/commit/1503bf912770f16bb15e6ae3fe359310bed623f5) fix: scale every living entity's box and eye height by minecraft:scale - [`f29cd0c`](https://github.com/horizon-rust/horizon/commit/f29cd0c74aa95df8a49c0e156b659cd533b5a657) test: a cow's 0.9 x 1.4 box at minecraft:scale 2 is 1.8 x 2.8 - [`d631761`](https://github.com/horizon-rust/horizon/commit/d63176135b10dabb9ab20a0c3829a381f8d7503a) port_map: LivingEntity.getDimensions and getScale rows - [`cd9e24f`](https://github.com/horizon-rust/horizon/commit/cd9e24fd82320ec8431da5744a608e119dcc61f6) Format the scale dimensions change - [`88c9e56`](https://github.com/horizon-rust/horizon/commit/88c9e568db8ed669c4123a95625cc3d8bd2750c1) Every living entity's model follows minecraft:scale - [`2ae5efe`](https://github.com/horizon-rust/horizon/commit/2ae5efe6fa5da128e99c9a551fc6cf22725b27b9) A scaled sleeping avatar's bed offset uses its scaled eye height ### 📊 Changes **7 files changed** (+265 additions, -54 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/remote.rs` (+4 -3) 📝 `crates/horizon-client/src/mobs.rs` (+4 -3) 📝 `crates/horizon-client/src/mobs/living.rs` (+117 -9) 📝 `crates/horizon-client/src/mobs/render.rs` (+128 -19) 📝 `crates/horizon-client/src/mobs/riders.rs` (+8 -13) 📝 `crates/horizon-client/src/shadows.rs` (+1 -6) 📝 `tools/port_map/game-006.tsv` (+3 -1) </details> ### 📄 Description Depends on #7844 (`fix/scale-dims`), which carries the shared commits `df52bce5c`, `507a23ff4`, `48474b4c5` and `dc219db84`; this PR is the renderer half its body leaves out, and those commits disappear from the diff when #7844 merges. ## Why From the 26.3 jar, `LivingEntityRenderer.submit` is, in order: ``` if (state.hasPose(Pose.SLEEPING) && state.bedOrientation != null) poseStack.translate(-stepX * (state.eyeHeight - 0.1f), 0, -stepZ * (state.eyeHeight - 0.1f)); float scale = state.scale; poseStack.scale(scale, scale, scale); this.setupRotations(state, poseStack, state.bodyRot, scale); poseStack.scale(-1.0f, -1.0f, 1.0f); this.scale(state, poseStack); poseStack.translate(0.0f, -1.501f, 0.0f); ``` `state.scale` is `LivingEntity.getScale()`, so every living entity's model takes `minecraft:scale`, not only the avatar's. Horizon had it only in `species_scale`'s avatar branch. #7844 gave every box and eye height the scale; this gives the model the same factor, in the same place. The order matters: the sleeping translate is emitted before the scale, so a scaled sleeper's bed offset must not grow. Putting the uniform scale at the end (or anywhere before the sleep translate) gets this wrong, and a later placement also leaves `setupRotations`'s own translations (the drowned's mid-box tip, the pufferfish bob, the avatar's swim offset) unscaled. `base_transform_at` now splits the bed offset out, then applies `Mob::model_scale()`, then `pufferfish_bob` + rotations, mirror, species `scale()` and the -1.501 translate. The avatar branch keeps only `AvatarRenderer.scale`'s 0.9375. The sleeping offset is `getEyeHeight(Pose.STANDING) - 0.1`, and `LivingEntity.getEyeHeight` goes through `getDimensions`, so the standing eye height carries `minecraft:scale` on an avatar too. The avatar branch used the type's 1.62 and put a scale-2 sleeper at the scale-1 distance from the pillow; it now multiplies by `Mob::model_scale()`, as the non-avatar branch's `awake_dims` already did. ## Values A sleeping villager (`eyeHeight` 1.62, `minecraft:scale` 2, facing north), bed-relative pose matrix after removing the bed offset, compared with twice the unscaled pose: | | diagonal | bed translation z | |---|---|---| | without this change (no uniform scale on a villager) | 1.0 | -1.501 | | uniform scale before the sleeping offset | 2.0 | 0.138 | | with this change (expected) | 2.0 | -3.002 | A sleeping avatar (0.9375 model, standing eye height 1.62, `minecraft:scale` 2), same comparison: the final z was -4.4343753 with the type's unscaled eye height; the scaled eye height gives -2.8143752. The diagonal is 1.875 (0.9375 x 2) in both. An avatar at `minecraft:scale` 2: 1.875 times the model, not 3.75; the duplicate factor read 3.75 before the avatar branch dropped it. No window or GPU is needed: the tests assert matrices from `base_transform_at`. ## Tests - `cargo test -q -p horizon-client-lib --lib mobs::render` - 31 passed, 1 ignored. - `cargo test -q -p horizon-client-lib --lib` - 1447 passed, 48 ignored. - `cargo test -q -p horizon-client-render --lib` - 1174 passed, 38 ignored. - `cargo clippy -q -p horizon-client-lib --lib --all-targets -- -D warnings` clean. - `cargo fmt --all -- --check` clean. New tests: `mobs::render::random_texture_tests::a_scaled_sleepers_bed_offset_is_not_scaled`, `a_scaled_sleeping_avatar_uses_its_scaled_eye_height` and `an_avatar_at_scale_two_scales_its_model_once`. --- <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#7874
No description provided.