[PR #908] [MERGED] Structures: horizon:spawner_mobs, the mods' spawner randomizing processors #2903

Closed
opened 2026-11-02 15:59:58 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: feat/spawner-mobs-processor


📝 Commits (2)

  • ae3622e Processors: read rule ids without a namespace, as vanilla does
  • 2ebc1c4 Structures: horizon:spawner_mobs, the mods' spawner randomizing processors

📊 Changes

1 file changed (+311 additions, -49 deletions)

View changed files

📝 crates/horizon-world/src/worldgen/structure/processor.rs (+311 -49)

📄 Description

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

Stacked on #907: merge that one first.

What

A new structure processor, horizon:spawner_mobs, picks a spawner's mob by weight when a template is placed and writes the spawner's NBT. It is the data form of the "spawner randomizing" processors in Moog's structure mods and in Repurposed Structures:

{"processor_type": "horizon:spawner_mobs",
 "mobs": [{"entity": {"id": "minecraft:piglin"}, "weight": 3}, {"entity": {"id": "minecraft:blaze"}, "weight": 1}],
 "delay": 20, "spawn_count": 4, "custom_spawn_rules": {...}, "replacement": {"Name": "minecraft:air"}}
  • It only touches minecraft:spawner blocks.
  • The pick uses the processor's position-seeded random and the mods' weighted draw: nextFloat * total, subtracting weights.
  • The spawner gets SpawnPotentials and SpawnData with the picked entity, and the seven timing shorts (Delay, MinSpawnDelay, MaxSpawnDelay, SpawnCount, MaxNearbyEntities, RequiredPlayerRange, SpawnRange).
  • With no mobs to pick, the spawner becomes replacement (air by default), as the mods do.

Why

The port step (horizon-port-pack) drops processors it can't run, so these spawners stayed empty or kept the template's placeholder pig. The carry change that writes these lists is #909. Until this PR is merged, the game refuses a list with an unknown processor type, so this one has to merge first.

Self-check

  • cargo fmt --check: clean
  • cargo clippy --workspace --all-targets -- -D warnings: clean
  • cargo test -p horizon-world: pass, including spawner_mobs_pick_by_weight, spawner_mobs_write_the_mods_nbt and spawner_mobs_refuse_a_mob_without_an_id
  • tools/parity.py --changed origin/main: 298 of 298 harnesses pass, run once on an integration of this PR, the other game PR of this set and origin/main 2b6ae71f (merge commit 234bd101)
  • Vanilla structure-start oracle (seed 1234, chunks -24..23): 35 of 35 match

Nothing here needs Ludovic.

🤖 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/908 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/18/2026 **Status:** ✅ Merged **Merged:** 10/18/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/spawner-mobs-processor` --- ### 📝 Commits (2) - [`ae3622e`](https://github.com/horizon-rust/horizon/commit/ae3622eb92c7b0f7adc10fe5d47c91f1ae419e1e) Processors: read rule ids without a namespace, as vanilla does - [`2ebc1c4`](https://github.com/horizon-rust/horizon/commit/2ebc1c44b33c153cc6140b8c353bbff1c00af9d4) Structures: horizon:spawner_mobs, the mods' spawner randomizing processors ### 📊 Changes **1 file changed** (+311 additions, -49 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-world/src/worldgen/structure/processor.rs` (+311 -49) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Stacked on #907: merge that one first. ## What A new structure processor, `horizon:spawner_mobs`, picks a spawner's mob by weight when a template is placed and writes the spawner's NBT. It is the data form of the "spawner randomizing" processors in Moog's structure mods and in Repurposed Structures: ```json {"processor_type": "horizon:spawner_mobs", "mobs": [{"entity": {"id": "minecraft:piglin"}, "weight": 3}, {"entity": {"id": "minecraft:blaze"}, "weight": 1}], "delay": 20, "spawn_count": 4, "custom_spawn_rules": {...}, "replacement": {"Name": "minecraft:air"}} ``` - It only touches `minecraft:spawner` blocks. - The pick uses the processor's position-seeded random and the mods' weighted draw: `nextFloat * total`, subtracting weights. - The spawner gets `SpawnPotentials` and `SpawnData` with the picked entity, and the seven timing shorts (Delay, MinSpawnDelay, MaxSpawnDelay, SpawnCount, MaxNearbyEntities, RequiredPlayerRange, SpawnRange). - With no mobs to pick, the spawner becomes `replacement` (air by default), as the mods do. ## Why The port step (horizon-port-pack) drops processors it can't run, so these spawners stayed empty or kept the template's placeholder pig. The carry change that writes these lists is #909. Until this PR is merged, the game refuses a list with an unknown processor type, so this one has to merge first. ## Self-check - `cargo fmt --check`: clean - `cargo clippy --workspace --all-targets -- -D warnings`: clean - `cargo test -p horizon-world`: pass, including `spawner_mobs_pick_by_weight`, `spawner_mobs_write_the_mods_nbt` and `spawner_mobs_refuse_a_mob_without_an_id` - `tools/parity.py --changed origin/main`: 298 of 298 harnesses pass, run once on an integration of this PR, the other game PR of this set and `origin/main` 2b6ae71f (merge commit 234bd101) - Vanilla structure-start oracle (seed 1234, chunks -24..23): 35 of 35 match Nothing here needs Ludovic. 🤖 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-02 15:59:58 +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#2903
No description provided.