Skip to content

Spawning and Structures

HIKI edited this page Oct 26, 2026 · 2 revisions

Spawning and structure replacement

File: tacznpc_structures.json. Root keys are structure registry IDs; each contains an array of replacement rules.

{
  "minecraft:village_plains": [
    {
      "entities":["minecraft:villager"],
      "loadout":"guard",
      "chance":0.25
    }
  ]
}
Field Meaning
entities Original entity-type IDs eligible for replacement
loadout Loadout assigned to the new NPC
chance Probability for this matching rule; use 0–1

Define the referenced loadout first. Multiple rules may be listed, but they are sequential chances, not one normalized weighted pool. A matching rule that fails its chance may be followed by another rule. Overlapping structures/rules should not be used to promise a precise aggregate ratio.

The hook marks qualifying STRUCTURE/NATURAL spawns and evaluates the replacement on the original mob's server tick. It only replaces mobs located in a matching registered structure. Once attempted, that marker is consumed; reload does not reroll the same mob indefinitely. At most one successful replacement is made. If another mod rejects the NPC spawn, the original remains.

This is not a global retroactive conversion of existing villagers and does not create population from nothing. Spawn eggs, command summons and arbitrary existing mobs do not become NPCs merely because they are in a structure. A loadout alone has no natural spawn registration.

The deferred path avoids world/config/loot queries in the generation callback, addressing this mod's previous C2ME worker-thread problem. It is not a compatibility guarantee for every world-generation mod combination.

Test a new area or summon a loadout directly to verify its equipment separately from generation. Use exact modded structure/entity registry IDs; Lost Cities layouts are not automatically mapped to these structure IDs.


Home · Configuration map · Troubleshooting

Clone this wiki locally