[PR #4958] [MERGED] Report a mooshroom's colour as its variant component #5971

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

📋 Pull Request Information

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

Base: main ← Head: fix/mooshroom-variant-component


📝 Commits (2)

  • 584f413 Report a mooshroom's colour as its variant component
  • c9fdb5f Merge origin/main into #4958 (port map: main's stew rows, this PR's variant rows)

📊 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

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.


🔄 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/4958 **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/mooshroom-variant-component` --- ### 📝 Commits (2) - [`584f413`](https://github.com/horizon-rust/horizon/commit/584f41373e8dbec8a5744f4167caef89b2621879) Report a mooshroom's colour as its variant component - [`c9fdb5f`](https://github.com/horizon-rust/horizon/commit/c9fdb5f790f31bb68ec9ee2918128d0e7c0a6ce3) Merge origin/main into #4958 (port map: main's stew rows, this PR's variant rows) ### 📊 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 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:16:18 +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#5971
No description provided.