Table of Contents

Class GenBlockLayersHost

Namespace
WorldgenLib
Assembly
WorldgenLib.VintageStory.dll

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.

public sealed class GenBlockLayersHost
Inheritance
GenBlockLayersHost
Inherited Members

Constructors

GenBlockLayersHost(ICoreServerAPI)

public GenBlockLayersHost(ICoreServerAPI api)

Parameters

api ICoreServerAPI

Methods

ApplyRaiseModifiers(int, int, float, IMapChunk)

Apply all registered raise modifiers to a column's raise value. Called during BlockLayers.OnChunkColumnGeneration.

public float ApplyRaiseModifiers(int localX, int localZ, float currentRaise, IMapChunk mapChunk)

Parameters

localX int
localZ int
currentRaise float
mapChunk IMapChunk

Returns

float

ApplySeaLevelFilters(int, int, IMapChunk)

Apply all registered sea-level-rise filters. Returns true if raise should be kept. If any filter returns false, the raise is zeroed. Called during BlockLayers.OnChunkColumnGeneration.

public bool ApplySeaLevelFilters(int localX, int localZ, IMapChunk mapChunk)

Parameters

localX int
localZ int
mapChunk IMapChunk

Returns

bool

FreezeHooks()

Freeze all hook lists. Called once after all StartServerSide have run.

public void FreezeHooks()

GetHookReport()

Get a diagnostic report of all registered hooks.

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

Returns

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

RegisterFullGeneration(string, double, BlockLayersGenerationHook)

Register a terminal replacement for the complete BlockLayers request. This is intended for migrations such as Watersheds whose stream-aware layer pass cannot be represented by a scalar raise modifier. Return true after handling the request.

public void RegisterFullGeneration(string modId, double order, BlockLayersGenerationHook hook)

Parameters

modId string
order double
hook BlockLayersGenerationHook

RegisterRaiseModifier(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 void RegisterRaiseModifier(string modId, double order, Func<int, int, float, IMapChunk, float> modifier)

Parameters

modId string

Owning mod identifier.

order double

Execution order within the step.

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

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

RegisterSeaLevelRiseFilter(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 void RegisterSeaLevelRiseFilter(string modId, double order, Func<int, int, IMapChunk, bool> filter)

Parameters

modId string

Owning mod identifier.

order double

Execution order within the step.

filter Func<int, int, IMapChunk, bool>

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