Table of Contents

Class WorldgenLibAPI

Namespace
WorldgenLib
Assembly
WorldgenLib.VintageStory.dll

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.

public static class WorldgenLibAPI
Inheritance
WorldgenLibAPI
Inherited Members

Properties

Distort2dX

Distortion noise for XZ warp.

public static SimplexNoise Distort2dX { get; }

Property Value

SimplexNoise

Distort2dZ

Distortion noise for Z warp.

public static SimplexNoise Distort2dZ { get; }

Property Value

SimplexNoise

GeoUpheavalNoise

Geo upheaval noise for large-scale lifts.

public static NormalizedSimplexNoise GeoUpheavalNoise { get; }

Property Value

NormalizedSimplexNoise

Instance

Get the WorldgenLib mod instance. Returns null if WorldgenLib is not loaded. Consumer mods should check for null and log a warning if WorldgenLib is missing.

public static WorldgenLibMod? Instance { get; }

Property Value

WorldgenLibMod

IsLoaded

Check if WorldgenLib is loaded and initialized. Use this before registering hooks. Returns true if WorldgenLib is available, false if not loaded.

public static bool IsLoaded { get; }

Property Value

bool

NoiseScale

Noise scale factor.

public static float NoiseScale { get; }

Property Value

float

TerrainGenOctaves

Number of terrain noise octaves.

public static int TerrainGenOctaves { get; }

Property Value

int

TerrainNoise

Terrain noise instance. Available after initWorldGen.

public static NewNormalizedSimplexFractalNoise TerrainNoise { get; }

Property Value

NewNormalizedSimplexFractalNoise

Methods

ForceClimateAt(ForceClimate)

Force a climate override at a world position with a radius.

public static void ForceClimateAt(ForceClimate climate)

Parameters

climate ForceClimate

ForceLandformAt(ForceLandform)

Force a landform at a world position with a radius. Applied during region generation.

public static void ForceLandformAt(ForceLandform landform)

Parameters

landform ForceLandform

ForceRandomLandArea(int, int, int)

Force a natural-looking land area around a world position. This is the public equivalent of GenMaps.ForceRandomLandArea.

public static void ForceRandomLandArea(int positionX, int positionZ, int radius)

Parameters

positionX int
positionZ int
radius int

GetHookReport()

Get a diagnostic report of all registered hooks across all steps. Useful for startup logging and debugging.

public static IReadOnlyList<(string Step, double Order, string ModId)> GetHookReport()

Returns

IReadOnlyList<(string Step, double Order, string ModId)>

GetMapGenerator(MapGeneratorStep)

Get the assembled generator for a map stage after initialization.

public static MapLayerBase GetMapGenerator(MapGeneratorStep step)

Parameters

step MapGeneratorStep

Returns

MapLayerBase

GetStepRegistry()

Get the step registry with all 25 registered step IDs.

public static StepRegistry GetStepRegistry()

Returns

StepRegistry

RegisterBlockLayersRaiseModifier(string, double, Func<int, int, float, IMapChunk, float>)

Register a hook that modifies terrain raise per-column. Called during BlockLayers.OnChunkColumnGeneration after vanilla raise computation. Return the modified raise value.

public static void RegisterBlockLayersRaiseModifier(string modId, double order, Func<int, int, float, IMapChunk, float> modifier)

Parameters

modId string

Your mod's identifier.

order double

Execution order within the step.

modifier Func<int, int, float, IMapChunk, float>

Delegate: (localX, localZ, currentRaise, mapChunk) → modifiedRaise.

RegisterBlockLayersSeaLevelFilter(string, double, Func<int, int, IMapChunk, bool>)

Register a hook that can disable sea-level-rise for a column. Return true to keep the raise, false to zero it.

public static void RegisterBlockLayersSeaLevelFilter(string modId, double order, Func<int, int, IMapChunk, bool> filter)

Parameters

modId string

Your mod's identifier.

order double

Execution order within the step.

filter Func<int, int, IMapChunk, bool>

Delegate: (localX, localZ, mapChunk) → true to keep raise.

RegisterCleanupRule(string, double, CleanupRuleHook)

Register a cleanup rule hook for GenTerraPostProcess. Return false to prevent deletion of a specific floating node.

public static void RegisterCleanupRule(string modId, double order, GenTerraPostProcessHost.CleanupRuleHook hook)

Parameters

modId string
order double
hook GenTerraPostProcessHost.CleanupRuleHook

RegisterFullBlockLayersGeneration(string, double, BlockLayersGenerationHook)

Register a terminal BlockLayers adapter. Return true only after the complete pass has been generated by the consumer.

public static void RegisterFullBlockLayersGeneration(string modId, double order, BlockLayersGenerationHook hook)

Parameters

modId string
order double
hook BlockLayersGenerationHook

RegisterFullMapRegionGeneration(string, double, MapRegionGenerationHook)

Register a terminal map-region adapter for consumers whose complete region pass cannot be decomposed into the nine vanilla maps.

public static void RegisterFullMapRegionGeneration(string modId, double order, MapRegionGenerationHook hook)

Parameters

modId string
order double
hook MapRegionGenerationHook

RegisterFullTerrainGeneration(string, double, TerrainGenerationHook)

Register a terminal terrain-column adapter for a full replacement that cannot be expressed through the atomic hooks.

public static void RegisterFullTerrainGeneration(string modId, double order, TerrainGenerationHook hook)

Parameters

modId string
order double
hook TerrainGenerationHook

RegisterMapGenerator(MapGeneratorStep, string, double, MapGeneratorHook)

Register a wrapper around one vanilla map-layer generator.

public static void RegisterMapGenerator(MapGeneratorStep step, string modId, double order, MapGeneratorHook hook)

Parameters

step MapGeneratorStep
modId string
order double
hook MapGeneratorHook

RegisterMapPadding(string, double, MapPaddingHook)

Register a replacement for a map stage's padding constant. This covers mods that previously rewrote a local GenMaps padding value.

public static void RegisterMapPadding(string modId, double order, MapPaddingHook hook)

Parameters

modId string
order double
hook MapPaddingHook

RegisterMapsBeach(string, double, MapsStepHook)

Register a hook at GenMaps Step 6 (Beach). Per-region.

public static void RegisterMapsBeach(string modId, double order, MapsStepHook hook)

Parameters

modId string
order double
hook MapsStepHook

RegisterMapsBiome(string, double, MapsStepHook)

Register a hook at GenMaps Step 8 (Biome). Per-region.

public static void RegisterMapsBiome(string modId, double order, MapsStepHook hook)

Parameters

modId string
order double
hook MapsStepHook

RegisterMapsClimate(string, double, MapsStepHook)

Register a hook at GenMaps Step 2 (Climate). Per-region.

public static void RegisterMapsClimate(string modId, double order, MapsStepHook hook)

Parameters

modId string
order double
hook MapsStepHook

RegisterMapsForest(string, double, MapsStepHook)

Register a hook at GenMaps Step 3 (Forest). Per-region.

public static void RegisterMapsForest(string modId, double order, MapsStepHook hook)

Parameters

modId string
order double
hook MapsStepHook

RegisterMapsGeoprovince(string, double, MapsStepHook)

Register a hook at GenMaps Step 1 (Geoprovince). Per-region.

public static void RegisterMapsGeoprovince(string modId, double order, MapsStepHook hook)

Parameters

modId string
order double
hook MapsStepHook

RegisterMapsLandform(string, double, MapsStepHook)

Register a hook at GenMaps Step 9 (Landform). Per-region.

public static void RegisterMapsLandform(string modId, double order, MapsStepHook hook)

Parameters

modId string
order double
hook MapsStepHook

RegisterMapsOcean(string, double, MapsStepHook)

Register a hook at GenMaps Step 5 (Ocean). Per-region.

public static void RegisterMapsOcean(string modId, double order, MapsStepHook hook)

Parameters

modId string
order double
hook MapsStepHook

RegisterMapsRegionFinalize(string, double, RegionFinalizeHook)

Register a hook at GenMaps RegionFinalize. After all maps, before DirtyForSaving.

public static void RegisterMapsRegionFinalize(string modId, double order, RegionFinalizeHook hook)

Parameters

modId string
order double
hook RegionFinalizeHook

RegisterMapsShrub(string, double, MapsStepHook)

Register a hook at GenMaps Step 7 (Shrub). Per-region.

public static void RegisterMapsShrub(string modId, double order, MapsStepHook hook)

Parameters

modId string
order double
hook MapsStepHook

RegisterMapsUpheavel(string, double, MapsStepHook)

Register a hook at GenMaps Step 4 (Upheavel). Per-region.

public static void RegisterMapsUpheavel(string modId, double order, MapsStepHook hook)

Parameters

modId string
order double
hook MapsStepHook

RegisterPostProcessOptOut(string, double, ChunkPostProcessHook)

Register an opt-out hook for GenTerraPostProcess. Return true to skip post-processing for this chunk (floating island deletion, etc.).

public static void RegisterPostProcessOptOut(string modId, double order, GenTerraPostProcessHost.ChunkPostProcessHook hook)

Parameters

modId string
order double
hook GenTerraPostProcessHost.ChunkPostProcessHook

RegisterStep0(string, double, BorderTaperHook)

Register a hook at Step 0 (BorderTaperPrepare). Per-chunk. Runs before the main generate loop. TaperMap is mutable here.

public static void RegisterStep0(string modId, double order, BorderTaperHook hook)

Parameters

modId string

Your mod's identifier.

order double

Execution order within the step (use OrderBands constants).

hook BorderTaperHook

The hook delegate.

RegisterStep10(string, double, PostPlacementHook)

Register a hook at Step 10 (PostPlacementColumn). Per-column, after block placement. Full block accessor available for carving, water placement, etc.

public static void RegisterStep10(string modId, double order, PostPlacementHook hook)

Parameters

modId string
order double
hook PostPlacementHook

RegisterStep2(string, double, BuildOctavesHook)

Register a hook at Step 2 (BuildCornerOctaves). Per-column, inside Parallel.For. Modify LandformWeights, OctaveAmplitudes, OctaveThresholds.

public static void RegisterStep2(string modId, double order, BuildOctavesHook hook)

Parameters

modId string
order double
hook BuildOctavesHook

RegisterStep4(string, double, VerticalDistortionHook)

Register a hook at Step 4 (VerticalDistortion). Per-column, inside Parallel.For. Modify DistY to add vertical displacement.

public static void RegisterStep4(string modId, double order, VerticalDistortionHook hook)

Parameters

modId string
order double
hook VerticalDistortionHook

RegisterStep5(string, double, WaterSelectHook)

Register a hook at Step 5 (WaterColumnSelect). Per-column, inside Parallel.For. Modify WaterBlockId to change water type (salt → fresh, etc.).

public static void RegisterStep5(string modId, double order, WaterSelectHook hook)

Parameters

modId string
order double
hook WaterSelectHook

RegisterStep7(string, double, ThresholdHook)

Register a hook at Step 7 (PerVoxelThreshold). Per-column, per-Y, inside Parallel.For. Return the modified threshold. This is the hottest hook — called ~256K times per chunk.

public static void RegisterStep7(string modId, double order, ThresholdHook hook)

Parameters

modId string
order double
hook ThresholdHook

RegisterTerrainFinalize(string, double, TerrainFinalizeHook)

Register a hook after all terrain columns and Step 10 hooks in a request have completed. Use it to persist chunk-wide arrays exactly once.

public static void RegisterTerrainFinalize(string modId, double order, TerrainFinalizeHook hook)

Parameters

modId string
order double
hook TerrainFinalizeHook

RequireLandAt(int, int)

Require a map coordinate to be generated as land. Calls made before worldgen initialization are queued by the canonical map host.

public static void RequireLandAt(int mapX, int mapZ)

Parameters

mapX int
mapZ int