HytaleDocs
Creating ContentWorld Generation

Shared Block Masks

Use shared block and fluid selections for replacement rules and placement substrates.

Block masks use the Server/WorldGen/BlockMasks asset root. Each filename supplies an asset key. Folders do not change the key.

Use Type: "Replacement" for prefab masks and cave carving masks. Use Type: "Blocks" for cover substrates and prefab ParentBlocks. Each field accepts an asset key or an inline asset with an explicit Type.

Replacement rules

This asset allows replacement of empty targets and protects stone targets. Save it as Replace_Empty_Protect_Stone.json.

{
  "Type": "Replacement",
  "Default": [
    { "Block": "Rock_Stone", "Replace": false },
    { "Block": "Empty" }
  ],
  "Specific": [
    {
      "Blocks": [{ "Block": "Rock_Stone" }],
      "Rule": [{ "Block": "Empty" }]
    }
  ]
}

Specific.Blocks selects the source block or fluid that the operation will place. Rule tests the current target block and fluid. Block keys in replacement rules include their variants. Later Specific groups override earlier groups for the same source.

Explicit rules keep their array order and run before wildcard rules. Wildcard rules also keep their array order. The first matching rule supplies the result. Replace defaults to true. An unmatched target is protected when a rule array is present.

If Default is absent, replacement requires an empty target block or an empty target fluid. An empty Default array protects every target that has no matching Specific group. Do not replace an absent array with an empty array.

Reference the mask from a prefab pattern:

{
  "Mask": "Replace_Empty_Protect_Stone"
}

Cave types use the BlockMask field. Cave nodes and prefab configurations use Mask.

Substrate selections

Save this asset as Match_Soil_Grass.json.

{
  "Type": "Blocks",
  "Blocks": [{ "Block": "Soil_Grass" }]
}

Use the key in a cover's Parent field or a prefab's ParentBlocks field. These fields retain their existing behavior when absent. An empty Blocks array matches nothing.

Each entry can specify Block, Fluid, or both. An omitted block or fluid means the empty value for that component. A match requires both components. Substrate selections use the listed blocks without variant expansion.

Inheritance and reload

A mask can use Parent to inherit another mask of the same type. Present arrays replace the inherited arrays. They do not append entries.

Mask changes participate in the world generation reload process. Each generator build resolves masks from one asset snapshot. An installed generator keeps its compiled masks until a replacement generator is ready. Missing mask references prevent the affected replacement generator from building.

Masks contain no seed fields, placement weights, offsets, or noise definitions. Weighted cover choices, cave filling choices, and procedural layer entries stay in their placement assets.

On this page