[PR #5354] [MERGED] Let the first part keep a name two parts share #6232

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5354
Author: @MSedgeMC
Created: 10/31/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: fix/pose-first-name-wins


📝 Commits (2)

📊 Changes

1 file changed (+22 additions, -1 deletions)

View changed files

📝 crates/horizon-client/src/mobs/anim.rs (+22 -1)

📄 Description

ModelPart.createPartLookup fills its name-to-part map with putIfAbsent, so of two parts sharing a name the first keeps it. Horizon's Poses::reset walked depth-first with a plain insert, so the last one won and both parts posed from a single entry.

One line to entry().or_insert(), plus a test: two same-named children with different poses, the first child's pose is the one the lookup returns.

Honest scope: this is a correctness fix for a latent bug, not a visible one I can demonstrate — entity-models.json is not in the worktree, so I could not show a baked model that actually repeats a name, and vanilla's own PartDefinition.addOrReplaceChild is name-keyed so stock models cannot collide. A collision would need to come from a prepared model or a mod pack.

Also left alone: Horizon's walk is depth-first while vanilla's ddAllChildren is level-first, so a name repeated between a shallow and a deeper part can still resolve differently. That is a larger change than this line.

Proven: the new test passes on a build box (cargo test -p horizon-client --lib a_name_two_parts_share → 1 passed).


🔄 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/5354 **Author:** [@MSedgeMC](https://github.com/MSedgeMC) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/pose-first-name-wins` --- ### 📝 Commits (2) - [`d1750f6`](https://github.com/horizon-rust/horizon/commit/d1750f6d66ac9d6ae9491d57e784d0e5d5d07ea9) Let the first part keep a name two parts share - [`84d1b7a`](https://github.com/horizon-rust/horizon/commit/84d1b7ac4449130863ee771b8727f3291d1c262c) Merge main into #5354 ### 📊 Changes **1 file changed** (+22 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/mobs/anim.rs` (+22 -1) </details> ### 📄 Description ModelPart.createPartLookup fills its name-to-part map with putIfAbsent, so of two parts sharing a name the **first** keeps it. Horizon's Poses::reset walked depth-first with a plain insert, so the last one won and both parts posed from a single entry. One line to entry().or_insert(), plus a test: two same-named children with different poses, the first child's pose is the one the lookup returns. **Honest scope:** this is a correctness fix for a latent bug, not a visible one I can demonstrate — entity-models.json is not in the worktree, so I could not show a baked model that actually repeats a name, and vanilla's own PartDefinition.addOrReplaceChild is name-keyed so stock models cannot collide. A collision would need to come from a prepared model or a mod pack. Also left alone: Horizon's walk is depth-first while vanilla's ddAllChildren is level-first, so a name repeated between a shallow and a deeper part can still resolve differently. That is a larger change than this line. **Proven:** the new test passes on a build box (cargo test -p horizon-client --lib a_name_two_parts_share → 1 passed). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:16:10 +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#6232
No description provided.