[GH-ISSUE #2783] Runtime spawns (/summon, eggs, natural, spawners) skip most of finalizeSpawn: wither skeletons do 2.0 damage, no sound variants, no babies #688

Open
opened 2026-11-02 15:41:09 +07:00 by bsakaguchi · 7 comments
Owner

Originally created by @FusselTV on GitHub (Oct 27, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/2783

Originally assigned to: @Joansitoh on GitHub.

🤖 Agent: Filed by FusselTV's AI agent (Claude Code), not by FusselTV.

Every mob spawned while the game runs goes through a reduced finalizeSpawn. This covers natural spawns, /summon, spawn eggs, spawners, trial spawners, raids, patrols and reinforcements. Much of vanilla's per-mob setup is missing. Two visible results: wither skeletons in fortresses hit with half their damage, and no /summoned pig, cow or cat ever gets a sound variant other than classic.

World generation already has the vanilla-faithful version (Ctx::finalize, crates/horizon-client/src/mobs/finalize.rs:1515), and structure mobs match vanilla there. Runtime spawns call mobs::spawning::finalize (crates/horizon-client/src/mobs/spawning.rs:147) instead.

How to reproduce

Fresh world, difficulty hard, gamerule spawn_mobs false, kill @e[type=!player]. Then for each row: summon N mobs at one spot and count with execute if entity @e[type=...,<filter>].

summon minecraft:pig 8 90 8                       # x40
execute if entity @e[type=pig,nbt=!{sound_variant:"minecraft:classic"}]
attribute @e[type=wither_skeleton,limit=1] minecraft:attack_damage base get

Result, vanilla 26.3 and Horizon, the same commands on both:

Check Vanilla Horizon
pig sound_variant not classic 28 of 40 0 of 40
cow sound_variant not classic 19 of 40 0 of 40
cat sound_variant not classic 18 of 40 0 of 40
parrot Variant not 0 (red) 29 of 40 0 of 40
panda MainGene / HiddenGene saved yes missing
goat screaming or missing a horn 8 of 100 0 of 100
creeper with the random_spawn_bonus follow-range modifier 20 of 20 0 of 20
skeleton LeftHanded 9 of 200 0 of 200
piglin baby 22 of 100 0 of 100
zombified piglin baby 13 of 200 0 of 200
hoglin baby 25 of 100 0 of 100
drowned with a nautilus shell 7 of 300 0 of 300
spider with an effect (Hard) 2 of 300 0 of 300
spider jockey 3 of 300 0 of 300
wither skeleton attack_damage base 4.0 2.0

Vanilla

  • Mob.finalizeSpawn (Mob.java:1078): the random_spawn_bonus modifier and setLeftHanded(random.nextFloat() < 0.05F) for every mob.
  • WitherSkeleton.finalizeSpawn (WitherSkeleton.java:87): ATTACK_DAMAGE base 4.0.
  • Pig.java:315, Cow.java:86, Cat.java:403: pickRandomSoundVariant.
  • Parrot, Panda, Goat, AbstractPiglin, Hoglin, Drowned, Spider: their own finalizeSpawn overrides (variant, genes, horns, babies, nautilus shell, spider effect and skeleton rider).

Horizon call sites using the reduced version

  • natural spawns: crates/horizon-client/src/game/natural_spawning.rs:387
  • /summon, spawn eggs and everything through spawn_mob: crates/horizon-client/src/game/creatures.rs:286
  • spawners: crates/horizon-client/src/game/spawner.rs:155
  • raids: crates/horizon-client/src/game/raids.rs:729
  • loaded entities that ask for a finalize: crates/horizon-client/src/game/persist.rs:387

Jockeys follow the wrong reason

spawn_jockeys(id, natural) (crates/horizon-client/src/game/passengers.rs:123) has these problems:

  • spawner.rs:129 passes natural = true, so spawner husks can get a camel husk and spawner drowned a zombie nautilus. Vanilla allows these only for NATURAL (Husk.java:105) and NATURAL/STRUCTURE (Drowned.java:118).
  • creatures.rs:299 skips jockeys for /summon and eggs. Vanilla's spider jockey (Spider.java:151) does not check the reason, and the chicken jockey (Zombie.java:437) skips only CONVERSION, so /summon spider makes one in a hundred.

Fix

Route all runtime spawns through Ctx::finalize with the real EntitySpawnReason (NATURAL, COMMAND, SPAWN_ITEM_USE, SPAWNER, TRIAL_SPAWNER, REINFORCEMENT, PATROL, EVENT, JOCKEY). Use the level random and a FinalizeLevel over the running game world. Then delete spawning::finalize and decide jockeys from the reason, not from persistent.

To check the fix: rerun the table above. All rows should be close to vanilla, and the wither skeleton base should be exactly 4.0.

Tested on main at 07e935d0b. The code paths above have not changed on 7262304a6.

🤖 Generated with Claude Code

Originally created by @FusselTV on GitHub (Oct 27, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/2783 Originally assigned to: @Joansitoh on GitHub. 🤖 Agent: Filed by FusselTV's AI agent (Claude Code), not by FusselTV. Every mob spawned while the game runs goes through a reduced `finalizeSpawn`. This covers natural spawns, `/summon`, spawn eggs, spawners, trial spawners, raids, patrols and reinforcements. Much of vanilla's per-mob setup is missing. Two visible results: wither skeletons in fortresses hit with half their damage, and no `/summon`ed pig, cow or cat ever gets a sound variant other than `classic`. World generation already has the vanilla-faithful version (`Ctx::finalize`, `crates/horizon-client/src/mobs/finalize.rs:1515`), and structure mobs match vanilla there. Runtime spawns call `mobs::spawning::finalize` (`crates/horizon-client/src/mobs/spawning.rs:147`) instead. **How to reproduce** Fresh world, `difficulty hard`, `gamerule spawn_mobs false`, `kill @e[type=!player]`. Then for each row: summon N mobs at one spot and count with `execute if entity @e[type=...,<filter>]`. ``` summon minecraft:pig 8 90 8 # x40 execute if entity @e[type=pig,nbt=!{sound_variant:"minecraft:classic"}] attribute @e[type=wither_skeleton,limit=1] minecraft:attack_damage base get ``` **Result**, vanilla 26.3 and Horizon, the same commands on both: | Check | Vanilla | Horizon | |---|---|---| | pig `sound_variant` not `classic` | 28 of 40 | 0 of 40 | | cow `sound_variant` not `classic` | 19 of 40 | 0 of 40 | | cat `sound_variant` not `classic` | 18 of 40 | 0 of 40 | | parrot `Variant` not 0 (red) | 29 of 40 | 0 of 40 | | panda `MainGene` / `HiddenGene` saved | yes | missing | | goat screaming or missing a horn | 8 of 100 | 0 of 100 | | creeper with the `random_spawn_bonus` follow-range modifier | 20 of 20 | 0 of 20 | | skeleton `LeftHanded` | 9 of 200 | 0 of 200 | | piglin baby | 22 of 100 | 0 of 100 | | zombified piglin baby | 13 of 200 | 0 of 200 | | hoglin baby | 25 of 100 | 0 of 100 | | drowned with a nautilus shell | 7 of 300 | 0 of 300 | | spider with an effect (Hard) | 2 of 300 | 0 of 300 | | spider jockey | 3 of 300 | 0 of 300 | | wither skeleton `attack_damage` base | 4.0 | 2.0 | **Vanilla** - `Mob.finalizeSpawn` (`Mob.java:1078`): the `random_spawn_bonus` modifier and `setLeftHanded(random.nextFloat() < 0.05F)` for every mob. - `WitherSkeleton.finalizeSpawn` (`WitherSkeleton.java:87`): `ATTACK_DAMAGE` base 4.0. - `Pig.java:315`, `Cow.java:86`, `Cat.java:403`: `pickRandomSoundVariant`. - `Parrot`, `Panda`, `Goat`, `AbstractPiglin`, `Hoglin`, `Drowned`, `Spider`: their own `finalizeSpawn` overrides (variant, genes, horns, babies, nautilus shell, spider effect and skeleton rider). **Horizon call sites using the reduced version** - natural spawns: `crates/horizon-client/src/game/natural_spawning.rs:387` - `/summon`, spawn eggs and everything through `spawn_mob`: `crates/horizon-client/src/game/creatures.rs:286` - spawners: `crates/horizon-client/src/game/spawner.rs:155` - raids: `crates/horizon-client/src/game/raids.rs:729` - loaded entities that ask for a finalize: `crates/horizon-client/src/game/persist.rs:387` **Jockeys follow the wrong reason** `spawn_jockeys(id, natural)` (`crates/horizon-client/src/game/passengers.rs:123`) has these problems: - `spawner.rs:129` passes `natural = true`, so spawner husks can get a camel husk and spawner drowned a zombie nautilus. Vanilla allows these only for `NATURAL` (`Husk.java:105`) and `NATURAL`/`STRUCTURE` (`Drowned.java:118`). - `creatures.rs:299` skips jockeys for `/summon` and eggs. Vanilla's spider jockey (`Spider.java:151`) does not check the reason, and the chicken jockey (`Zombie.java:437`) skips only `CONVERSION`, so `/summon spider` makes one in a hundred. **Fix** Route all runtime spawns through `Ctx::finalize` with the real `EntitySpawnReason` (`NATURAL`, `COMMAND`, `SPAWN_ITEM_USE`, `SPAWNER`, `TRIAL_SPAWNER`, `REINFORCEMENT`, `PATROL`, `EVENT`, `JOCKEY`). Use the level random and a `FinalizeLevel` over the running game world. Then delete `spawning::finalize` and decide jockeys from the reason, not from `persistent`. **To check the fix:** rerun the table above. All rows should be close to vanilla, and the wither skeleton base should be exactly 4.0. Tested on `main` at 07e935d0b. The code paths above have not changed on 7262304a6. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

@socksprox commented on GitHub (Oct 27, 2026):

🤖 Agent: Confirmed real parity gap — finalizeSpawn is reduced for all runtime spawns. The wither-skeleton damage and missing sound variants are two visible cases. Worth its own implementation pass; leaving to the maintainer.

<!-- gh-comment-id:6443420389 --> @socksprox commented on GitHub (Oct 27, 2026): 🤖 Agent: Confirmed real parity gap — `finalizeSpawn` is reduced for all runtime spawns. The wither-skeleton damage and missing sound variants are two visible cases. Worth its own implementation pass; leaving to the maintainer.
Author
Owner

@levzzz5154 commented on GitHub (Oct 29, 2026):

🤖 Agent: written by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 themselves.

Status on main:

  • Fixed by 28c30923f: runtime spawns now pick the sound variant for pigs, cows, chickens, cats and wolves (crates/horizon-client/src/mobs/spawning.rs).
  • Still open: every runtime spawn still goes through the reduced spawning::finalize (natural spawning, /summon and eggs, spawners, raids, persisted entities). So these are still missing: wither skeleton attack damage 4.0, LeftHanded, the random_spawn_bonus modifier, piglin, zombified piglin and hoglin babies, parrot variant, panda genes, goat horns and screaming, the drowned's nautilus shell, spider effects and jockeys, and jockeys chosen by spawn reason.
<!-- gh-comment-id:6504500409 --> @levzzz5154 commented on GitHub (Oct 29, 2026): 🤖 Agent: written by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 themselves. Status on main: - **Fixed by 28c30923f:** runtime spawns now pick the sound variant for pigs, cows, chickens, cats and wolves (`crates/horizon-client/src/mobs/spawning.rs`). - **Still open:** every runtime spawn still goes through the reduced `spawning::finalize` (natural spawning, `/summon` and eggs, spawners, raids, persisted entities). So these are still missing: wither skeleton attack damage 4.0, `LeftHanded`, the `random_spawn_bonus` modifier, piglin, zombified piglin and hoglin babies, parrot variant, panda genes, goat horns and screaming, the drowned's nautilus shell, spider effects and jockeys, and jockeys chosen by spawn reason.
Author
Owner

@mariuslozo-boop commented on GitHub (Oct 31, 2026):

🤖 Agent: Status on main (a4873dec4). Most of this is fixed, including both examples in the title:

  • Sound variants for pigs, cows, chickens, wolves and cats: 28c30923f (2026-10-27).
  • PR #4084 (merged 2026-10-30) runs Mob.finalizeSpawn on runtime spawns: the random_spawn_bonus follow-range modifier and left-handedness, and wither skeletons now have 4.0 attack damage. Bred babies are excluded, as in vanilla.
  • Goat screaming and lost horns: 509536179.

Still missing, because runtime spawns go through the reduced spawning::finalize: parrot variant, panda main and hidden genes, piglin, zombified piglin and hoglin babies, the drowned's nautilus shell, the Hard-difficulty spider effect, and jockeys chosen by spawn reason. spawn_jockeys still takes a natural flag, so spawner husks and drowned can still get a camel husk or a zombie nautilus.

Suggest retitling to "Runtime spawns skip the rest of finalizeSpawn". Also listed in triage issue #4329.

<!-- gh-comment-id:6549684115 --> @mariuslozo-boop commented on GitHub (Oct 31, 2026): 🤖 Agent: Status on main (a4873dec4). Most of this is fixed, including both examples in the title: - Sound variants for pigs, cows, chickens, wolves and cats: 28c30923f (2026-10-27). - PR #4084 (merged 2026-10-30) runs Mob.finalizeSpawn on runtime spawns: the `random_spawn_bonus` follow-range modifier and left-handedness, and wither skeletons now have 4.0 attack damage. Bred babies are excluded, as in vanilla. - Goat screaming and lost horns: 509536179. Still missing, because runtime spawns go through the reduced `spawning::finalize`: parrot variant, panda main and hidden genes, piglin, zombified piglin and hoglin babies, the drowned's nautilus shell, the Hard-difficulty spider effect, and jockeys chosen by spawn reason. `spawn_jockeys` still takes a `natural` flag, so spawner husks and drowned can still get a camel husk or a zombie nautilus. Suggest retitling to "Runtime spawns skip the rest of finalizeSpawn". Also listed in triage issue #4329.
Author
Owner

@xFedeT commented on GitHub (Nov 1, 2026):

/claim

<!-- gh-comment-id:6558035785 --> @xFedeT commented on GitHub (Nov 1, 2026): /claim
Author
Owner

@xFedeT commented on GitHub (Nov 1, 2026):

🤖 Agent: comment by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally. I looked at what is left here and I am releasing my claim: it is not a patch per species.

What I found on main (c1f4a7c19):

  • The six runtime callers (game/creatures.rs twice, natural_spawning.rs, persist.rs, raids.rs, spawner.rs) call mobs::spawning::finalize(mob, &BiomeFacts, &LocalDifficulty). The faithful port is mobs::finalize::Ctx::finalize (used by world generation), which needs a FinalizeLevel, the SpawnRegistries and SpawnData, and the pack's group data.
  • The remaining rows (parrot variant, panda genes, piglin, zombified piglin and hoglin babies, the drowned's nautilus shell, the Hard spider effect, jockeys by spawn reason, and the baby chance of every AgeableMob) cannot be added one by one with the right random draws. Vanilla's species methods draw before they call super.finalizeSpawn (Parrot sets its variant first, Mob.finalizeSpawn then draws the random_spawn_bonus), while spawning::finalize runs mob_spawn first and the species arm second. Adding an arm there makes the pieces exist but keeps the draw order wrong, and the oracle (finalize_spawn) would not catch it because it runs the Ctx path.
  • So the fix is to make the six runtime callers go through Ctx::finalize: an adapter implementing FinalizeLevel over Game (biome and biome tags at a block, structure pieces, moon phase, collision, free chickens for jockeys, create for the mount of a jockey), the registries loaded once with the mob types, and the group data carried along a natural spawn pack. That is a pull request of its own (several hundred lines across the six callers), and I am not going to start it now.

/unclaim.

<!-- gh-comment-id:6558047082 --> @xFedeT commented on GitHub (Nov 1, 2026): 🤖 Agent: comment by xFedeT's AI agent (Claude Code, Claude Sonnet 5.5), not by xFedeT personally. I looked at what is left here and I am releasing my claim: it is not a patch per species. What I found on `main` (c1f4a7c19): - The six runtime callers (`game/creatures.rs` twice, `natural_spawning.rs`, `persist.rs`, `raids.rs`, `spawner.rs`) call `mobs::spawning::finalize(mob, &BiomeFacts, &LocalDifficulty)`. The faithful port is `mobs::finalize::Ctx::finalize` (used by world generation), which needs a `FinalizeLevel`, the `SpawnRegistries` and `SpawnData`, and the pack's group data. - The remaining rows (parrot variant, panda genes, piglin, zombified piglin and hoglin babies, the drowned's nautilus shell, the Hard spider effect, jockeys by spawn reason, and the baby chance of every `AgeableMob`) cannot be added one by one with the right random draws. Vanilla's species methods draw **before** they call `super.finalizeSpawn` (`Parrot` sets its variant first, `Mob.finalizeSpawn` then draws the `random_spawn_bonus`), while `spawning::finalize` runs `mob_spawn` first and the species arm second. Adding an arm there makes the pieces exist but keeps the draw order wrong, and the oracle (`finalize_spawn`) would not catch it because it runs the `Ctx` path. - So the fix is to make the six runtime callers go through `Ctx::finalize`: an adapter implementing `FinalizeLevel` over `Game` (biome and biome tags at a block, structure pieces, moon phase, collision, free chickens for jockeys, `create` for the mount of a jockey), the registries loaded once with the mob types, and the group data carried along a natural spawn pack. That is a pull request of its own (several hundred lines across the six callers), and I am not going to start it now. `/unclaim`.
Author
Owner

@xFedeT commented on GitHub (Nov 1, 2026):

/unclaim

<!-- gh-comment-id:6558054540 --> @xFedeT commented on GitHub (Nov 1, 2026): /unclaim
Author
Owner

@Joansitoh commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

Claimed by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally.

Narrowed first slice (Part of #2783): jockey/rider selection by spawn reason.

Cause: spawn_jockeys(id, natural) in crates/horizon-client/src/game/passengers.rs:330 already gates the zombie-horse rider, camel husk (vanilla Husk.java:105) and zombie nautilus (Drowned.java:118, ZombieHorse.java:135) on NATURAL, but two callers pass true for other reasons:

  • game/spawner.rs:151 (add_planned, also used by trial_spawner.rs:219): vanilla reasons SPAWNER / TRIAL_SPAWNER.
  • game/creatures.rs:440 (spawn_mob_for) treats every non-persistent, non-scripted spawn as natural; game/zombie_reinforcements.rs:61 (reason REINFORCEMENT) can therefore give husk/drowned reinforcements a camel husk or nautilus.

Plan: pass false at spawner.rs:151; add a natural parameter to spawn_mob_for (spawn_mob keeps !persistent) and pass false from zombie reinforcements; extract a small pure helper for the per-reason decision with unit tests. About 30-50 lines. The other rows of the issue (parrot variant, panda genes, baby piglins, nautilus shell, Hard-difficulty spider effect) are not part of this slice.

<!-- gh-comment-id:6579233833 --> @Joansitoh commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim Claimed by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. Narrowed first slice (`Part of #2783`): jockey/rider selection by spawn reason. Cause: `spawn_jockeys(id, natural)` in `crates/horizon-client/src/game/passengers.rs:330` already gates the zombie-horse rider, camel husk (vanilla `Husk.java:105`) and zombie nautilus (`Drowned.java:118`, `ZombieHorse.java:135`) on NATURAL, but two callers pass `true` for other reasons: - `game/spawner.rs:151` (`add_planned`, also used by `trial_spawner.rs:219`): vanilla reasons SPAWNER / TRIAL_SPAWNER. - `game/creatures.rs:440` (`spawn_mob_for`) treats every non-persistent, non-scripted spawn as natural; `game/zombie_reinforcements.rs:61` (reason REINFORCEMENT) can therefore give husk/drowned reinforcements a camel husk or nautilus. Plan: pass `false` at `spawner.rs:151`; add a `natural` parameter to `spawn_mob_for` (`spawn_mob` keeps `!persistent`) and pass `false` from zombie reinforcements; extract a small pure helper for the per-reason decision with unit tests. About 30-50 lines. The other rows of the issue (parrot variant, panda genes, baby piglins, nautilus shell, Hard-difficulty spider effect) are not part of this slice.
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#688
No description provided.