Skip to content

API reference Obsidian.API.World.Features

IWorldGenLevel interface

Synchronous block access used while generating a chunk, like vanilla's WorldGenLevel.

public interface IWorldGenLevel

In Obsidian.API.

Remarks

During feature placement this covers the chunk being decorated and its 8 neighbors; writes outside the writable area are ignored and IWorldGenLevel.SetBlock returns false.

Properties

int Height { get; }int MinY { get; }

Random

IRandomSource Random { get; }

The level's own random, like vanilla's WorldGenRegion.getRandom: seeded from the world seed and the chunk being decorated, and separate from the random of the feature or structure being placed.

int SeaLevel { get; }

Seed

long Seed { get; }

World seed.

UnlitBrightness

int UnlitBrightness { get; }

Raw brightness before lighting: 15 with skylight, otherwise 0.

Methods

AddEntity(GeneratedEntity)

void AddEntity(GeneratedEntity entity);

Adds an entity to the chunk at its position; it spawns once that chunk is complete.

EnsureCanWrite(Vector)

bool EnsureCanWrite(Vector position);

Whether position is inside the area this level may write to.

BiomeCodec GetBiome(Vector position);IBlock GetBlock(Vector position);

GetBlockEntity(Vector)

IBlockEntity GetBlockEntity(Vector position);

Gets the block entity at position, or null when there's none.

GetHeight(HeightmapType, int, int)

int GetHeight(HeightmapType type, int x, int z);

First free Y above the highest block matching the heightmap at (x, z).

GetStateId(Vector)

int GetStateId(Vector position);

The state id of the block at position, like IWorldGenLevel.GetBlock; levels that store state ids read it without resolving the block.

bool IsOutsideBuildHeight(int y);

MarkForPostProcessing(Vector)

void MarkForPostProcessing(Vector position);

Marks a block to be checked against its neighbors once its chunk is complete (fence connections, torch support...), like vanilla's markPosForPostprocessing.

ScheduleFluidTick(Vector)

void ScheduleFluidTick(Vector position);

Schedules a fluid update at position for when generation completes, like vanilla's scheduleTick with a fluid (springs, geode cracks).

SetBlock(Vector, IBlock)

bool SetBlock(Vector position, IBlock block);

Sets a block, updating heightmaps. Returns false when the position can't be written.

SetBlockEntity(Vector, IBlockEntity)

void SetBlockEntity(Vector position, IBlockEntity blockEntity);

Stores a block entity (chests, spawners...) created by a feature.

On this page