Namespace WorldgenLib
Classes
- ChunkContext
Per-chunk context passed to hooks at steps 0, 1, and 10. Contains region map samples, config values, and mutable taper map.
- ConflictDetector
Detects legacy full world-generation takeovers without mistaking an ordinary additive worldgen delegate for a conflict. Reports are advisory unless the foreign delegate/patch clearly owns the same vanilla pass as WorldgenLib.
- GenBlockLayersHost
Host for GenBlockLayers behavior. Provides hooks for the raise modifier and sea-level-rise filter, replacing the Harmony transpilers used by Rivers-Mod, VSRiverGen, and Terra Prety.
Consumer mods register delegates during StartServerSide. After all registrations, FreezeHooks() locks the lists. During chunk generation, the host applies all registered modifiers/filters in order.
- GenMapsHost
Faithful reimplementation of vanilla GenMaps server-side behavior. Generates the nine region maps (geoprovince, climate, forest, upheavel, ocean, beach, shrub, biome, landform) plus the force mechanisms and the client latitude channel.
When no hooks are registered, the output is byte-identical to vanilla for the same seed and config. Consumer mods register effects at the nine map steps or at RegionFinalize.
The static factory methods (GetClimateMapGen, GetOceanMapGen, etc.) are called on the vanilla GenMaps class — they are public static and do not depend on GenMaps instance state.
- GenTerraHost
Faithful reimplementation of vanilla GenTerra as GenTerraHost. The generate method is split into 11 named steps (0–10), each a faithful move of the vanilla code with no logic change.
Phase 3: no hooks invoked. Parity with vanilla when empty. Phase 4: hook points wired at each step.
- GenTerraPostProcessHost
Faithful reimplementation of vanilla GenTerraPostProcess. BFS-floods every solid block with air below and deletes floating islands of 40 blocks or fewer.
Phase 5: no hooks invoked beyond opt-out. Parity with vanilla when empty. Phase 6+: opt-out hook, cleanup rule hooks.
- LandformRegistry
Canonical registry for vanilla and custom landform variants.
Vanilla landforms are imported before consumer StartServerSide methods are called. Custom variants are appended to the same Vintagestory.ServerMods.NoObf.LandformsWorldProperty.LandFormsByIndex array, initialized with the current world height, and therefore receive the same numeric index used by the terrain host. A later vanilla landform reload is rebound automatically through Reload().
- LandformRegistry.RegisteredLandform
A landform plus its canonical numeric index.
- MapGeneratorContext
Immutable factory information plus the current vanilla generator. A map-generator hook may return the current generator, wrap it, or replace it with a compatible generator.
- OrderBands
Order band constants for the ordered-delegate model. Consumers pick a band and an offset inside it.
- OrderedHookList<T>
Generic ordered-delegate registry. Each step holds a sorted list of (order, index, delegate) tuples. Frozen after initWorldGen.
- RegionContext
Per-region context passed to GenMaps hooks at steps 1–9 and RegionFinalize. Contains the map region, noise sizes, and mutable map data.
- RegionMapRegistry
Registry for persistent, bounded custom maps attached to an Vintagestory.API.Common.IMapRegion. A slot is registered during mod startup and its data is serialized into the region's permanent moddata when the host finishes a region.
- RegionMapSlot
A named, dimensioned custom map with persistent region access.
- SamplingModifiers
Optional modifiers for terrain sampling. Apply transformations to the noise pipeline at arbitrary positions.
- StartupReport
Generates a startup report listing every registered effect, owner, step, and order value. Printed at server startup for diagnostics.
- StepId
Stable step ID constants for the WorldgenLib worldgen pipeline. Use these when registering hooks to ensure forward compatibility.
Steps without hook points (1, 3, 6, 8, 9) are listed for documentation but cannot have hooks registered on them.
- StepRegistry
Versioned step registry. Each step has a stable string ID, a human-readable name, and a version at which it was introduced. When Vintage Story restructures the vanilla code, the remap table maps old step IDs to new ones so consumer delegates keep applying. A removed step degrades to a logged no-op.
- StepRegistry.StepDefinition
Metadata for a single pipeline step. Immutable after registration.
- TerrainSampler
Samples the terrain pipeline at arbitrary world positions without placing blocks. Replaces the GenTerraSampler fork that Watersheds currently maintains.
Thread-safe: uses thread-local temp data internally.
Usage:
int height = TerrainSampler.SampleHeight(worldX, worldZ); double threshold = TerrainSampler.SampleThreshold(worldX, worldZ, posY);
- WorldgenLibAPI
Public API facade for WorldgenLib. Consumer mods call these static methods to register hooks on the worldgen pipeline.
Usage from a consumer mod's StartServerSide:
WorldgenLibAPI.RegisterStep7("my-mod", OrderBands.AfterVanillaMin + 50, MyThresholdHook);Registration must happen during StartServerSide, before InitWorldGen freezes the hook lists. After freezing, attempts to register throw InvalidOperationException.
- WorldgenLibMod
WorldgenLib mod entry point. Registers as a ModSystem and installs the worldgen hosts (GenMapsHost, GenTerraHost, GenTerraPostProcessHost, GenBlockLayersHost) when no conflicting full-replacement generator is detected. The hosts form one cooperative canonical pass; a foreign takeover is detected before that pass is initialized.
Structs
- ColumnCarvingContext
Per-column context for step 10 hooks. Full block accessor available.
- ColumnContext
Per-column context inside the Parallel.For loop. Mutable fields are applied by the host after each hook returns.
- GenTerraHost.WeightedTaper
Per-column taper data for border smoothing. Written at Step 0, read at Step 7 for chunk-border blending.
- OrderedHookList<T>.HookEntry
Immutable ordered entry used by hot-path callers. The array is published once at Freeze and never mutated afterwards.
Enums
- MapGeneratorStep
Map generator seams exposed by the vanilla GenMaps factory chain.
Delegates
- BlockLayersGenerationHook
Terminal complete-pass hook for vanilla GenBlockLayers. Return true when the consumer handled the request and the vanilla pass should be skipped; return false to let the next hook or vanilla continue.
- BorderTaperHook
Hook delegate for step 0 (BorderTaperPrepare) — per-chunk.
- BuildOctavesHook
Hook delegate for step 2 (BuildCornerOctaves) — per-column.
- GenTerraPostProcessHost.ChunkPostProcessHook
Hook delegate for opting a chunk out of post-processing.
- GenTerraPostProcessHost.CleanupRuleHook
Hook delegate called when a floating node is found. Return true to delete it.
- MapGeneratorHook
Ordered seam around one of the vanilla GenMaps factories.
- MapPaddingHook
Adjusts the padding requested for one vanilla map stage. This is a lifecycle-safe replacement for transpilers that only changed a local padding constant in GenMaps.OnMapRegionGen.
- MapRegionGenerationHook
Terminal map-region hook. Return true after generating the complete region to suppress WorldgenLib's default nine-step pass.
- MapsStepHook
Hook delegate for GenMaps map steps — per-region.
- PostPlacementHook
Hook delegate for step 10 (PostPlacementColumn) — per-column.
- RegionFinalizeHook
Hook delegate for GenMaps RegionFinalize — after all maps, before DirtyForSaving.
- TerrainFinalizeHook
Hook after all columns in a terrain request have completed placement and Step 10. This is the safe boundary for chunk-wide arrays such as river flow vectors and map data that must be written exactly once per request.
- TerrainGenerationHook
Terminal terrain hook. Return true when the consumer generated the complete column and WorldgenLib must skip its vanilla-compatible pass. Returning false leaves the pass to the next handler or to WorldgenLib.
- ThresholdHook
Hook delegate for step 7 (PerVoxelThreshold) — per-column, per-Y. Returns the modified threshold.
- VerticalDistortionHook
Hook delegate for step 4 (VerticalDistortion) — per-column.
- WaterSelectHook
Hook delegate for step 5 (WaterColumnSelect) — per-column.