Table of Contents

Class ChunkContext

Namespace
WorldgenLib
Assembly
WorldgenLib.VintageStory.dll

Per-chunk context passed to hooks at steps 0, 1, and 10. Contains region map samples, config values, and mutable taper map.

public sealed class ChunkContext
Inheritance
ChunkContext
Inherited Members

Constructors

ChunkContext(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, float, int, double, WeightedTaper[], SimplexNoise, float[][], LandformsWorldProperty, LerpedWeightedIndex2DMap, float, float, float, IServerChunk[]?, IMapChunk?, IChunkColumnGenerateRequest?, int, int, int, int)

Creates a ChunkContext with all region-level data needed by hooks. Parameters are grouped: coordinates, region map corners, config, noise, landforms.

public ChunkContext(int chunkX, int chunkZ, int climateUpLeft, int climateUpRight, int climateBotLeft, int climateBotRight, int oceanUpLeft, int oceanUpRight, int oceanBotLeft, int oceanBotRight, int upheavalUpLeft, int upheavalUpRight, int upheavalBotLeft, int upheavalBotRight, int seaLevel, int mapSizeY, float oceanicityFactor, int taperThreshold, double geoUpheavalAmplitude, GenTerraHost.WeightedTaper[] taperMap, SimplexNoise distort2dX, float[][] terrainYThresholds, LandformsWorldProperty landforms, LerpedWeightedIndex2DMap landLerpMap, float chunkPixelSize, float baseX, float baseZ, IServerChunk[]? chunks = null, IMapChunk? mapChunk = null, IChunkColumnGenerateRequest? request = null, int rockBlockId = 0, int freshWaterBlockId = 0, int saltWaterBlockId = 0, int lakeIceBlockId = 0)

Parameters

chunkX int
chunkZ int
climateUpLeft int
climateUpRight int
climateBotLeft int
climateBotRight int
oceanUpLeft int
oceanUpRight int
oceanBotLeft int
oceanBotRight int
upheavalUpLeft int
upheavalUpRight int
upheavalBotLeft int
upheavalBotRight int
seaLevel int
mapSizeY int
oceanicityFactor float
taperThreshold int
geoUpheavalAmplitude double
taperMap WeightedTaper[]
distort2dX SimplexNoise
terrainYThresholds float[][]
landforms LandformsWorldProperty
landLerpMap LerpedWeightedIndex2DMap
chunkPixelSize float
baseX float
baseZ float
chunks IServerChunk[]
mapChunk IMapChunk
request IChunkColumnGenerateRequest
rockBlockId int
freshWaterBlockId int
saltWaterBlockId int
lakeIceBlockId int

Properties

BaseX

public float BaseX { get; }

Property Value

float

BaseZ

public float BaseZ { get; }

Property Value

float

ChunkPixelSize

public float ChunkPixelSize { get; }

Property Value

float

ChunkSize

public int ChunkSize { get; }

Property Value

int

ChunkX

public int ChunkX { get; }

Property Value

int

ChunkZ

public int ChunkZ { get; }

Property Value

int

Chunks

Vertical chunks produced for this terrain request.

public IServerChunk[] Chunks { get; }

Property Value

IServerChunk[]

ClimateBotLeft

public int ClimateBotLeft { get; }

Property Value

int

ClimateBotRight

public int ClimateBotRight { get; }

Property Value

int

ClimateUpLeft

public int ClimateUpLeft { get; }

Property Value

int

ClimateUpRight

public int ClimateUpRight { get; }

Property Value

int

CustomData

Per-chunk state shared by hooks. Keys must be namespaced by the owning mod (for example, strata:elevation).

public IDictionary<string, object?> CustomData { get; }

Property Value

IDictionary<string, object>

Distort2dX

public SimplexNoise Distort2dX { get; }

Property Value

SimplexNoise

Distort2dZ

public SimplexNoise Distort2dZ { get; }

Property Value

SimplexNoise

FreshWaterBlockId

Resolved fresh-water block ID.

public int FreshWaterBlockId { get; }

Property Value

int

GeoUpheavalAmplitude

public double GeoUpheavalAmplitude { get; }

Property Value

double

GeoUpheavalNoise

public NormalizedSimplexNoise GeoUpheavalNoise { get; }

Property Value

NormalizedSimplexNoise

LakeIceBlockId

Resolved lake-ice block ID.

public int LakeIceBlockId { get; }

Property Value

int

LandLerpMap

public LerpedWeightedIndex2DMap LandLerpMap { get; }

Property Value

LerpedWeightedIndex2DMap

LandformMap

public IntDataMap2D LandformMap { get; }

Property Value

IntDataMap2D

Landforms

public LandformsWorldProperty Landforms { get; }

Property Value

LandformsWorldProperty

MapChunk

Map chunk produced for this terrain request.

public IMapChunk MapChunk { get; }

Property Value

IMapChunk

MapRegion

Region containing the maps used by this terrain request.

public IMapRegion MapRegion { get; }

Property Value

IMapRegion

MapSizeY

public int MapSizeY { get; }

Property Value

int

OceanBotLeft

public int OceanBotLeft { get; }

Property Value

int

OceanBotRight

public int OceanBotRight { get; }

Property Value

int

OceanUpLeft

public int OceanUpLeft { get; }

Property Value

int

OceanUpRight

public int OceanUpRight { get; }

Property Value

int

OceanicityFactor

public float OceanicityFactor { get; }

Property Value

float

RegionMapSize

public int RegionMapSize { get; }

Property Value

int

RegionX

public int RegionX { get; }

Property Value

int

RegionZ

public int RegionZ { get; }

Property Value

int

Request

The original request, available to a finalization hook.

public IChunkColumnGenerateRequest Request { get; }

Property Value

IChunkColumnGenerateRequest

RockBlockId

Resolved rock block ID used by the terrain pass.

public int RockBlockId { get; }

Property Value

int

SaltWaterBlockId

Resolved salt-water block ID.

public int SaltWaterBlockId { get; }

Property Value

int

SeaLevel

public int SeaLevel { get; }

Property Value

int

TaperMap

public GenTerraHost.WeightedTaper[] TaperMap { get; set; }

Property Value

WeightedTaper[]

TaperThreshold

public int TaperThreshold { get; }

Property Value

int

TerrainNoise

public NewNormalizedSimplexFractalNoise TerrainNoise { get; }

Property Value

NewNormalizedSimplexFractalNoise

TerrainYThresholds

public float[][] TerrainYThresholds { get; }

Property Value

float[][]

UpheavalBotLeft

public int UpheavalBotLeft { get; }

Property Value

int

UpheavalBotRight

public int UpheavalBotRight { get; }

Property Value

int

UpheavalUpLeft

public int UpheavalUpLeft { get; }

Property Value

int

UpheavalUpRight

public int UpheavalUpRight { get; }

Property Value

int

Methods

GetOrCreateCustomData<T>(string, Func<T>)

Gets a typed per-request value, creating it once if absent. The collection is safe to initialize from parallel column hooks; the value itself remains owned by the consumer and must be partitioned or synchronized by that consumer.

public T GetOrCreateCustomData<T>(string key, Func<T> factory)

Parameters

key string
factory Func<T>

Returns

T

Type Parameters

T

SetChunkModdata<T>(string, T)

Write generic moddata to the first generated chunk.

public void SetChunkModdata<T>(string key, T data)

Parameters

key string
data T

Type Parameters

T

SetMapChunkModdata<T>(string, T)

Write generic moddata to the generated map chunk.

public void SetMapChunkModdata<T>(string key, T data)

Parameters

key string
data T

Type Parameters

T

TryGetCustomData<T>(string, out T?)

Try to read typed per-request state without creating it.

public bool TryGetCustomData<T>(string key, out T? value)

Parameters

key string
value T

Returns

bool

Type Parameters

T