Skip to content

API World Generation

Piggo41 edited this page Oct 12, 2026 · 17 revisions

World generation

Lua API / World generation

BetaMoon world generation uses declarations: scripts register reusable content during initialization, and Minecraft generates chunks using those declarations. Lua callbacks do not run once per block or placement. The world seed, stable registration keys, chunk position, and local element keys provide deterministic random choices.

Changes affect terrain generated after the declaration changes. They do not rewrite blocks in existing chunks. Regional structures are the exception in one useful sense: BetaMoon saves their chosen multi-chunk plan and completes its remaining parts as the relevant chunks become available.

How the pieces fit together

  1. A feature describes what may be placed, such as a tree, ore vein, or local structure.
  2. A placement decides where and how often a feature is attempted and which conditions must pass.
  3. A biome source decides where keyed biomes occur. Biomes can provide a surface and biome-scoped placements.
  4. A surface replaces the top layers of terrain for a biome before ordinary feature placement.
  5. A regional structure assembles registered local structures into a persistent multi-chunk layout.

Use stable keys for declarations whose generated results should remain reproducible. Put registrations in mod initialization code, not in action callbacks.

API guides

Reference Covers
Features and placements Reusable features, scheduled placement rules, direct placement, previews, and rejection reasons.
Trees Procedural, vanilla-adapter, and structure-backed tree features.
Local structures Registering, transforming, exporting, and placing a structure.
Structure documents Palettes, blocks, markers, processing order, validation, and links to the detailed format guides.
Structure geometry Compact primitives such as fills, shells, lines, cylinders, and voxel maps.
Structure composition Templates, transforms, repeats, choices, and conflict policies.
Structure processors Deterministic replacement, decay, erosion, deposit, selectors, and protected cells.
Lua structures Authoring the same structure model with Lua tables or the builder API.
Structure inventory loot Fixed and randomized inventory contents in structures.
Structure terrain placement Surface sampling, rigid fitting, foundations, terraces, conforming paths, excavation, and site checks.
Regional structures Deterministic multi-chunk structures assembled from local templates.
Surfaces Reusable deterministic top-to-bottom surface layer stacks.
Biomes and biome sources Biome identity, decorators, weather, spawns, surfaces, and climate selection.
Ores Ore generation rules, placement limits, lookup, and overrides.

The World content debug export lists declarations, ordering, selected biome sources, and generation diagnostics. It is useful when a declaration loads successfully but does not appear where expected.

Clone this wiki locally