Skip to content

API reference Obsidian.API.World.Features.Trees

RootPlacer class

Places roots below a raised trunk, like vanilla's RootPlacer (only mangroves use one). Plugins add types with RegisterWorldgenType<RootPlacer, T>.

public abstract class RootPlacer

In Obsidian.API.

Constructors

protected RootPlacer();

Properties

public AboveRootPlacement AboveRootPlacement { get; init; }public required IBlockStateProvider RootProvider { get; init; }

TrunkOffsetY

public required IIntProvider TrunkOffsetY { get; init; }

How far above the feature origin the trunk starts.

public string Type { get; init; }

Methods

CanPlaceRoot(IWorldGenLevel, Vector)

protected virtual bool CanPlaceRoot(IWorldGenLevel level, Vector position);

Vanilla TreeFeature.validTreePos: air or #replaceable_by_trees.

GetPotentiallyWaterloggedState(IWorldGenLevel, Vector, IBlock)

protected static IBlock GetPotentiallyWaterloggedState(IWorldGenLevel level, Vector position, IBlock block);

Waterlogs states that support it when the position holds any water (vanilla FluidTags.WATER).

public Vector GetTrunkOrigin(Vector origin, IRandomSource random);protected virtual void PlaceRoot(TreeContext tree, Vector position);

PlaceRoots(TreeContext, Vector, Vector)

public abstract bool PlaceRoots(TreeContext tree, Vector origin, Vector trunkOrigin);

Places the roots between origin and trunkOrigin; false aborts the tree.

On this page