Skip to content

API reference Obsidian.API.World.Structures

CustomPieceContext class

What a CustomStructurePiece or CustomPoolElement sees while it's placed in the chunk being decorated. Only the server creates contexts.

public abstract class CustomPieceContext

In Obsidian.API.

Properties

Box

public abstract BlockArea Box { get; }

The part of the chunk being decorated that the piece may place in; each chunk the piece reaches places its own part.

Generation

public abstract WorldGenerationContext Generation { get; }

The vertical range height providers and vertical anchors resolve in.

Level

public abstract IWorldGenLevel Level { get; }

The chunks around the chunk being decorated, in world coordinates.

Origin

public abstract Vector Origin { get; }

The world position offsets are from: a piece's lowest corner, or a pool element's origin.

Random

public abstract IRandomSource Random { get; }

Seeded for the structure and the chunk being decorated.

Rotation

public abstract PieceRotation Rotation { get; }

How a pool element is turned around its origin; PieceRotation.None for a piece.

Methods

SetBlock(Vector, IBlock)

public abstract bool SetBlock(Vector offset, IBlock block);

Places a block at an offset from CustomPieceContext.Origin, turned with the piece by CustomPieceContext.Rotation, when it's in CustomPieceContext.Box.

Returns

Whether the block was placed.

ToWorld(Vector)

public abstract Vector ToWorld(Vector offset);

The world position of an offset from CustomPieceContext.Origin, turned by CustomPieceContext.Rotation.

On this page