[PR #4307] [MERGED] Hang nametags from the pose box, not the sneak flag #5551

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4307
Author: @MSedgeMC
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/4129-nametag-pose-height


📝 Commits (1)

  • c0f16e6 Hang nametags from the pose box, not the sneak flag

📊 Changes

2 files changed (+105 additions, -13 deletions)

View changed files

📝 crates/horizon-client/src/game/names.rs (+101 -12)
📝 crates/horizon-client/src/game/perspective.rs (+4 -1)

📄 Description

Fixes #4129 (the height half; see the last paragraph for what the video shows).

Vanilla anchors a name tag at the entity's NAME_TAG attachment, (0, bbHeight, 0) of the box of the current pose — Avatar.POSES gives 1.8 standing, 1.5 crouching, 0.6 for swimming/gliding/spin-attack, 0.2 sleeping — and the submitter lifts it 0.5. The sneak flag's only part in it is Entity.isDiscrete(), the see-through pass. Player.getDesiredPose puts SWIMMING and FALL_FLYING ahead of CROUCHING, so shifting while swimming really is a 0.6 box with the crouch bit set.

Horizon used the flag: if player && m.extra.crouching { 1.5 } else { m.height() }. So a swimmer or glider holding shift got a tag at 2.0 instead of 1.1, and a rider holding shift at 2.0 instead of 2.3. The height now comes from m.height(), which reads the pose box.

That override existed because the local player's model never filled extra.avatar_pose — guests fill it in lan.rs and server players in remote_mob_data.rs, but nothing filled it for self.player_model, so its m.height() was a permanent 1.8. tick_player_model now stores the pose it already computes, and the crouching/standing heights are unchanged (2.0 and 2.3).

What is proven: the test ran on a build box — cargo test -p horizon-client --bin horizon-client name_tag -> 1 passed. It asserts 1.1 for a crouching-flag swimming pose, 2.0 for crouching and 2.3 for standing, and the first is red on today's code. The vanilla numbers were re-read independently from the jar (attachment fallback, Avatar.POSES, getDimensions, the submitter's +0.5).

What is not proven, and the reviewer should know it: the test sets extra.avatar_pose by hand, so the perspective.rs line — the local player's own tag — is not covered by it; reverting that line would leave the test green. That needs eyes or a LAN check: own tag in third person while crouched (2.0) and while swimming/gliding with shift (1.1). pr_ready was not run on this branch either; CI's verify is the workspace check.

Two things left out deliberately, both pre-existing: m.height() for players hard-codes Pose::dimensions(1.0), so a player with the minecraft:scale attribute still gets a tag at the unscaled height (the code comment says so), and the inventory preview at perspective.rs:667 repeats the same flag-based height — same bug class, its own fix.

The report's video shows tags for entities that are not in view, which is the missing frustum culling on tag extraction rather than this height bug; vanilla skips entities failing shouldRender. Separate issue if wanted.


🔄 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/4307 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/4129-nametag-pose-height` --- ### 📝 Commits (1) - [`c0f16e6`](https://github.com/horizon-rust/horizon/commit/c0f16e65e2601d611e9f69b3758722a03b4bbd73) Hang nametags from the pose box, not the sneak flag ### 📊 Changes **2 files changed** (+105 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game/names.rs` (+101 -12) 📝 `crates/horizon-client/src/game/perspective.rs` (+4 -1) </details> ### 📄 Description Fixes #4129 (the height half; see the last paragraph for what the video shows). Vanilla anchors a name tag at the entity's `NAME_TAG` attachment, `(0, bbHeight, 0)` of the box of the **current pose** — `Avatar.POSES` gives 1.8 standing, 1.5 crouching, 0.6 for swimming/gliding/spin-attack, 0.2 sleeping — and the submitter lifts it 0.5. The sneak flag's only part in it is `Entity.isDiscrete()`, the see-through pass. `Player.getDesiredPose` puts SWIMMING and FALL_FLYING ahead of CROUCHING, so shifting while swimming really is a 0.6 box with the crouch bit set. Horizon used the flag: `if player && m.extra.crouching { 1.5 } else { m.height() }`. So a swimmer or glider holding shift got a tag at 2.0 instead of 1.1, and a rider holding shift at 2.0 instead of 2.3. The height now comes from `m.height()`, which reads the pose box. That override existed because the local player's model never filled `extra.avatar_pose` — guests fill it in `lan.rs` and server players in `remote_mob_data.rs`, but nothing filled it for `self.player_model`, so its `m.height()` was a permanent 1.8. `tick_player_model` now stores the pose it already computes, and the crouching/standing heights are unchanged (2.0 and 2.3). **What is proven:** the test ran on a build box — `cargo test -p horizon-client --bin horizon-client name_tag` -> 1 passed. It asserts 1.1 for a crouching-flag swimming pose, 2.0 for crouching and 2.3 for standing, and the first is red on today's code. The vanilla numbers were re-read independently from the jar (attachment fallback, `Avatar.POSES`, `getDimensions`, the submitter's `+0.5`). **What is not proven, and the reviewer should know it:** the test sets `extra.avatar_pose` by hand, so the `perspective.rs` line — the local player's own tag — is *not* covered by it; reverting that line would leave the test green. That needs eyes or a LAN check: own tag in third person while crouched (2.0) and while swimming/gliding with shift (1.1). `pr_ready` was not run on this branch either; CI's `verify` is the workspace check. Two things left out deliberately, both pre-existing: `m.height()` for players hard-codes `Pose::dimensions(1.0)`, so a player with the `minecraft:scale` attribute still gets a tag at the unscaled height (the code comment says so), and the inventory preview at `perspective.rs:667` repeats the same flag-based height — same bug class, its own fix. The report's video shows tags for entities that are not in view, which is the missing frustum culling on tag extraction rather than this height bug; vanilla skips entities failing `shouldRender`. Separate issue if wanted. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:21 +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#5551
No description provided.