Skip to content

API reference Obsidian.API.World.Structures

StructureProcessor class

Changes or drops template blocks as they're placed, like vanilla's StructureProcessor. Data names a processor by its processor_type; plugins add types with RegisterWorldgenType<StructureProcessor, T>.

public abstract class StructureProcessor

In Obsidian.API.

Remarks

Instances come from processor-list data and are shared between threads; keep them stateless.

Constructors

protected StructureProcessor();

Properties

ProcessesWholeTemplate

public virtual bool ProcessesWholeTemplate { get; }

Whether the processor's result for a block depends on the template's other blocks (it uses StructureProcessor.FinalizeProcessing or a random shared between blocks), so the whole template must be processed even when only part of it is placed.

public string Type { get; init; }

Methods

FinalizeProcessing(IWorldGenLevel, Vector, Vector, IReadOnlyList<StructureBlockInfo>, List<StructureBlockInfo>, TemplatePlacement)

public virtual List<StructureBlockInfo> FinalizeProcessing(IWorldGenLevel level, Vector origin, Vector pivot, IReadOnlyList<StructureBlockInfo> originals, List<StructureBlockInfo> processed, TemplatePlacement placement);

Vanilla finalizeProcessing: runs once all blocks went through StructureProcessor.ProcessBlock, with the kept blocks (processed) and their template originals at the same indices.

Returns

The blocks to place.

ProcessBlock(IWorldGenLevel, Vector, Vector, StructureBlockInfo, StructureBlockInfo, TemplatePlacement)

public virtual StructureBlockInfo? ProcessBlock(IWorldGenLevel level, Vector origin, Vector pivot, StructureBlockInfo original, StructureBlockInfo current, TemplatePlacement placement);

Returns the block to place for current, or null to skip it.

Parameters

level
The level the template is placed in.
origin
World position of the template's origin.
pivot
World position of the rotation pivot.
original
The raw template block (template-relative position).
current
The block so far, at its world position.
placement
How the template is placed.

On this page