[PR #5315] [CLOSED] Report a mooshroom's colour as its variant component (finished from #4958) #6202

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5315
Author: @ludovic111
Created: 10/31/2026
Status: ❌ Closed

Base: main ← Head: agent/finish-4958


📝 Commits (1)

📊 Changes

3 files changed (+43 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+18 -2)
📝 crates/horizon-client/src/mobs/finalize.rs (+23 -0)
📝 tools/port_map/animal-1.tsv (+2 -2)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Finished from #4958 by @MSedgeMC: their commits, kept with their authorship, plus a merge of main (the fork doesn't allow maintainer edits). The original's body:


Closes the MushroomCow.get row in the port ledger. (No issue.)

MushroomCow.get(DataComponentGetter) answers with minecraft:mooshroom/variant — red or brown — and applyImplicitComponents reads it back, which is how a mooshroom spawned from an egg keeps the colour the egg names. Horizon's finalize::species_variant_component lists wolf, cat, frog, pig, cow, chicken and zombie nautilus, but not the mooshroom, so the component was never reported; variant_name fell through to the frog's temperate/warm/cold table and variant_index could not recognise brown. Reading the component into a mob already worked (it landed with #4504).

Both names are confirmed from the pinned 26.3 jar: MushroomCow$Variant's constant pool holds RED/BROWN with the serialized names red/brown, and DataComponents carries mooshroom/variant.

One consequence that had to be handled: mob_to_nbt wrote a generic variant key for every species the component table knew, so adding the mooshroom would have saved variant:"minecraft:brown" beside vanilla's Type:"brown". The generic write now skips the mooshroom, and the saved compound stays byte-identical — tools/test_save_roundtrip_parity.py deep-diffs those compounds and would have caught the extra key.

Proven: on a build box, cargo test -p horizon-client --lib mooshroom_reports → 1 passed (both directions: component and name for red and brown, an unknown name and an out-of-range index falling back to red) and item_component_tests → 1 passed with the prepared 26.3 data (a brown mooshroom egg through apply_item_components and back out as the component).

Not proven: nothing in a game — no mob spawned from an egg with a component in front of a player, and test_save_roundtrip_parity was not run here; the argument that it stays green is that the saved keys are unchanged. pr_ready was not run, so CI's verify is the workspace check.


Closes #4958 once merged.

🤖 Generated with Claude Code


🔄 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/5315 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/31/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `agent/finish-4958` --- ### 📝 Commits (1) - [`8b56913`](https://github.com/horizon-rust/horizon/commit/8b56913130c362ef977a1b2f6505bd9874905c03) Merge main into #4958 ### 📊 Changes **3 files changed** (+43 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+18 -2) 📝 `crates/horizon-client/src/mobs/finalize.rs` (+23 -0) 📝 `tools/port_map/animal-1.tsv` (+2 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Finished from #4958 by @MSedgeMC: their commits, kept with their authorship, plus a merge of main (the fork doesn't allow maintainer edits). The original's body: --- Closes the `MushroomCow.get` row in the port ledger. (No issue.) `MushroomCow.get(DataComponentGetter)` answers with `minecraft:mooshroom/variant` — `red` or `brown` — and `applyImplicitComponents` reads it back, which is how a mooshroom spawned from an egg keeps the colour the egg names. Horizon's `finalize::species_variant_component` lists wolf, cat, frog, pig, cow, chicken and zombie nautilus, but not the mooshroom, so the component was never reported; `variant_name` fell through to the frog's `temperate/warm/cold` table and `variant_index` could not recognise `brown`. Reading the component into a mob already worked (it landed with #4504). Both names are confirmed from the pinned 26.3 jar: `MushroomCow$Variant`'s constant pool holds `RED`/`BROWN` with the serialized names `red`/`brown`, and `DataComponents` carries `mooshroom/variant`. One consequence that had to be handled: `mob_to_nbt` wrote a generic `variant` key for every species the component table knew, so adding the mooshroom would have saved `variant:"minecraft:brown"` beside vanilla's `Type:"brown"`. The generic write now skips the mooshroom, and the saved compound stays byte-identical — `tools/test_save_roundtrip_parity.py` deep-diffs those compounds and would have caught the extra key. **Proven:** on a build box, `cargo test -p horizon-client --lib mooshroom_reports` → 1 passed (both directions: component and name for red and brown, an unknown name and an out-of-range index falling back to red) and `item_component_tests` → 1 passed with the prepared 26.3 data (a brown mooshroom egg through `apply_item_components` and back out as the component). **Not proven:** nothing in a game — no mob spawned from an egg with a component in front of a player, and `test_save_roundtrip_parity` was not run here; the argument that it stays green is that the saved keys are unchanged. `pr_ready` was not run, so CI's `verify` is the workspace check. --- Closes #4958 once merged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:15:51 +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#6202
No description provided.