API reference / @jsprismarine/prismarine / GeneratorFactories
Class: GeneratorFactories
Defined in: prismarine/src/world/GeneratorFactories.ts:92
The generator kinds a server can build, keyed by kind id.
Starts with the built-in kinds unless told otherwise: minecraft:noise, minecraft:flat, minecraft:debug and jsprismarine:void.
Constructors
Constructor
new GeneratorFactories(
factories?):GeneratorFactories
Defined in: prismarine/src/world/GeneratorFactories.ts:102
Parameters
factories?
Iterable<GeneratorFactory> = ...
The factories to start with. Defaults to the built-in kinds; pass an empty list for a registry that knows nothing.
Returns
GeneratorFactories
Methods
build()
build(
context):Generator
Defined in: prismarine/src/world/GeneratorFactories.ts:125
Builds the generator a stem asks for.
Parameters
context
Returns
Throws
When no factory answers the stem's kind. The message lists the kinds that are registered, which is what a person who misspelled one needs.
kinds()
kinds(): readonly
string[]
Defined in: prismarine/src/world/GeneratorFactories.ts:138
The registered kind ids, in registration order.
Returns
readonly string[]
register()
register(
factory):void
Defined in: prismarine/src/world/GeneratorFactories.ts:112
Adds a factory under its kind.
Parameters
factory
Returns
void
Throws
When the kind is already registered. A second factory for one kind would silently change which generator every stem of that kind gets.
stopGenerating()
stopGenerating():
void
Defined in: prismarine/src/world/GeneratorFactories.ts:149
Gives up the queued chunks of every generator this registry built.
Called at the top of a shutdown, before anything is awaited. What is already being generated finishes; what is only queued is dropped, since the save that follows writes the chunks a world has in memory and a chunk the generator never started is not one of them.
Returns
void