[PR #5271] [CLOSED] fix(mobs): a spawn egg's entity_data component reaches the mob it spawns #6180

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

📋 Pull Request Information

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

Base: main ← Head: fix/spawn-egg-entity-data


📝 Commits (1)

  • a2b3d46 fix(mobs): a spawn egg's entity_data component reaches the mob it spawns

📊 Changes

2 files changed (+106 additions, -32 deletions)

View changed files

📝 crates/horizon-client/src/entity_nbt.rs (+105 -31)
📝 tools/port_map/game-005.tsv (+1 -1)

📄 Description

🤖 Opened by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi personally.

What and why

A spawn egg that carries an entity configuration spawns a plain entity. minecraft:entity_data — what /give @s pig_spawn_egg[minecraft:entity_data={NoAI:1b, …}] sets, and what a data pack can put on an egg or an entity item — was never read: entity_nbt::apply_item_components knew minecraft:bucket_entity_data (a bucket's contents) and the variant/name components, and stopped there. A configured egg therefore spawned a default mob with no name, health, flags or variant.

This is the EntityType.updateCustomEntityTag row of #3514 (one of the seven rows my audit of that list found genuinely missing).

apply_item_components now applies both compounds through one helper, apply_entity_config, in that order, so the egg's own entity_data wins over a bucket's older copy. CustomName joins the fields the helper loads (it is part of saved entity data; the bucket path benefits too).

Vanilla reference

EntityType.updateCustomEntityTag — the entity loads the stack's minecraft:entity_data compound — reached from PostSpawnProcessor.apply on a spawn egg and from the dispenser's egg path. The compound is the same saved-entity shape a bucket's minecraft:bucket_entity_data holds, which is why one helper serves both; the fields read are the ones the bucket path already honoured (Age, AgeLocked, Variant, Health, NoAI, Silent, NoGravity, Glowing, Invulnerable, PersistenceRequired, the axolotl's hunting cooldown) plus CustomName.

The test is entity_nbt::entity_data_component_tests::a_spawn_eggs_entity_data_component_reaches_the_mob: it puts NoAI, Silent, PersistenceRequired, Health and CustomName on a pig spawn egg, applies the components and checks each lands, then checks entity_data beats bucket_entity_data on a shared field.

Kind

  • parity: Horizon now does what vanilla 26.3 does

Other projects' code

none

Self-check

cargo fmt --all --check                     clean
cargo clippy -p horizon-client --lib --tests -- -D warnings
  Finished `dev` profile [unoptimized + debuginfo]  (no warnings)
cargo test -p horizon-client --lib entity_nbt
  18 passed, 0 failed
  a_spawn_eggs_entity_data_component_reaches_the_mob  ok
python3 tools/check_public_tree.py
  Public tree check passed.

As on my other pull requests: this machine has no .local/ vanilla data, so the test takes the same early return as its neighbours (CI and a maintainer's machine run it in full), and tools/pr_ready.py/tools/parity.py need Python 3.11+ while only 3.9 is installed — the block above is their Rust half. The harnesses this can reach are the entity NBT and spawn-egg ones.

tools/port_map/game-005.tsv: the EntityType.updateCustomEntityTag row is port now.

One thing I did not do: the list's other row, EntityType.appendCustomEntityStackConfig, is the writer side (what an item is configured from), and its exact output needs the vanilla source; this change closes the player-visible symptom both rows describe (a configured egg spawning an unconfigured mob), not that method.

🤖 Generated with DeepSeek Harness (deepseek-v4.1-flash)


🔄 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/5271 **Author:** [@sirrayi](https://github.com/sirrayi) **Created:** 10/31/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/spawn-egg-entity-data` --- ### 📝 Commits (1) - [`a2b3d46`](https://github.com/horizon-rust/horizon/commit/a2b3d46a7a4e928eb95d4a5046cb1bae43b29827) fix(mobs): a spawn egg's entity_data component reaches the mob it spawns ### 📊 Changes **2 files changed** (+106 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity_nbt.rs` (+105 -31) 📝 `tools/port_map/game-005.tsv` (+1 -1) </details> ### 📄 Description > 🤖 Opened by sirrayi's AI agent (DeepSeek Harness, deepseek-v4.1-flash), not by sirrayi personally. ## What and why A spawn egg that carries an entity configuration spawns a plain entity. `minecraft:entity_data` — what `/give @s pig_spawn_egg[minecraft:entity_data={NoAI:1b, …}]` sets, and what a data pack can put on an egg or an entity item — was never read: `entity_nbt::apply_item_components` knew `minecraft:bucket_entity_data` (a bucket's contents) and the variant/name components, and stopped there. A configured egg therefore spawned a default mob with no name, health, flags or variant. This is the `EntityType.updateCustomEntityTag` row of #3514 (one of the seven rows my audit of that list found genuinely missing). `apply_item_components` now applies both compounds through one helper, `apply_entity_config`, in that order, so the egg's own `entity_data` wins over a bucket's older copy. `CustomName` joins the fields the helper loads (it is part of saved entity data; the bucket path benefits too). ## Vanilla reference `EntityType.updateCustomEntityTag` — the entity `load`s the stack's `minecraft:entity_data` compound — reached from `PostSpawnProcessor.apply` on a spawn egg and from the dispenser's egg path. The compound is the same saved-entity shape a bucket's `minecraft:bucket_entity_data` holds, which is why one helper serves both; the fields read are the ones the bucket path already honoured (Age, AgeLocked, Variant, Health, NoAI, Silent, NoGravity, Glowing, Invulnerable, PersistenceRequired, the axolotl's hunting cooldown) plus CustomName. The test is `entity_nbt::entity_data_component_tests::a_spawn_eggs_entity_data_component_reaches_the_mob`: it puts `NoAI`, `Silent`, `PersistenceRequired`, `Health` and `CustomName` on a pig spawn egg, applies the components and checks each lands, then checks `entity_data` beats `bucket_entity_data` on a shared field. ## Kind - [x] parity: Horizon now does what vanilla 26.3 does ## Other projects' code none ## Self-check ``` cargo fmt --all --check clean cargo clippy -p horizon-client --lib --tests -- -D warnings Finished `dev` profile [unoptimized + debuginfo] (no warnings) cargo test -p horizon-client --lib entity_nbt 18 passed, 0 failed a_spawn_eggs_entity_data_component_reaches_the_mob ok python3 tools/check_public_tree.py Public tree check passed. ``` As on my other pull requests: this machine has no `.local/` vanilla data, so the test takes the same early return as its neighbours (CI and a maintainer's machine run it in full), and `tools/pr_ready.py`/`tools/parity.py` need Python 3.11+ while only 3.9 is installed — the block above is their Rust half. The harnesses this can reach are the entity NBT and spawn-egg ones. `tools/port_map/game-005.tsv`: the `EntityType.updateCustomEntityTag` row is `port` now. One thing I did **not** do: the list's other row, `EntityType.appendCustomEntityStackConfig`, is the writer side (what an item is configured from), and its exact output needs the vanilla source; this change closes the player-visible symptom both rows describe (a configured egg spawning an unconfigured mob), not that method. 🤖 Generated with [DeepSeek Harness](https://www.deepseek.com) (deepseek-v4.1-flash) --- <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:36 +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#6180
No description provided.