Skip to content

API reference Obsidian.API.World

ILevelFactory interface

public interface ILevelFactory

In Obsidian.API.

Methods

CreateDimension(IWorld, string, string)

IDimension CreateDimension(IWorld parentWorld, string name, string generatorId);

Creates a new dimension within the specified parent world with the given name and generator.

Parameters

parentWorld
The parent world in which to create the dimension.
name
The name of the dimension to create.
generatorId
The ID of the dimension generator to use.

Returns

The created dimension.

CreateWorld(string, string, string)

IWorld CreateWorld(string name, string seed, string generatorId);

Creates a new world with the specified name and generator.

Parameters

name
The name of the world to create.
seed
The seed to use for world generation.
generatorId
The namspaced ID of the world generator to use.

Returns

The created world.

Initialize()

void Initialize();

Initializes the level factory, preparing it for use. This may involve setting up internal data structures, registering default generators, or performing any necessary setup tasks to ensure that the factory is ready to create worlds and dimensions.

RegisterGenerator<T>()

void RegisterGenerator<T>() where T : ILevelGenerator, new();

Registers a new level generator of the specified type, by its ILevelGenerator.Id.

Type parameters

T
The type of the level generator to register.

Remarks

A generator registered through the level factory a plugin is given (injected, or from its services) is the plugin's, removed when the plugin unloads, like one registered with IPluginRegistry.RegisterGenerator, which plugins should prefer: it names the generator in the plugin's namespace and creates it with the plugin's services. The first registered with an id keeps it.

On this page