PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\world\generator\GeneratorManager Class Reference
+ Collaboration diagram for pocketmine\world\generator\GeneratorManager:

Public Member Functions

 addAlias (string $name, string $alias)
 
 addGenerator (string $class, string $name, \Closure $presetValidator, bool $overwrite=false)
 
 getGenerator (string $name)
 
 getGeneratorList ()
 
 getGeneratorName (string $class)
 

Detailed Description

Definition at line 33 of file GeneratorManager.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\world\generator\GeneratorManager::__construct ( )

Definition at line 42 of file GeneratorManager.php.

Member Function Documentation

◆ addAlias()

pocketmine\world\generator\GeneratorManager::addAlias ( string  $name,
string  $alias 
)

Aliases an already-registered generator name to another name. Useful if you want to map a generator name to an existing generator without having to replicate the parameters.

Definition at line 87 of file GeneratorManager.php.

◆ addGenerator()

pocketmine\world\generator\GeneratorManager::addGenerator ( string  $class,
string  $name,
\Closure  $presetValidator,
bool  $overwrite = false 
)
Parameters
string$classFully qualified name of class that extends \pocketmine\world\generator\Generator
string$nameAlias for this generator type that can be written in configs
\Closure$presetValidatorCallback to validate generator options for new worlds
bool$overwriteWhether to force overwriting any existing registered generator with the same name

@phpstan-param \Closure(string) : ?InvalidGeneratorOptionsException $presetValidator

@phpstan-param class-string<Generator> $class

Exceptions

InvalidArgumentException

Definition at line 72 of file GeneratorManager.php.

◆ getGenerator()

pocketmine\world\generator\GeneratorManager::getGenerator ( string  $name)

Returns the generator entry of a registered Generator matching the given name, or null if not found.

Definition at line 111 of file GeneratorManager.php.

◆ getGeneratorList()

pocketmine\world\generator\GeneratorManager::getGeneratorList ( )

Returns a list of names for registered generators.

Returns
string[]

Definition at line 104 of file GeneratorManager.php.

◆ getGeneratorName()

pocketmine\world\generator\GeneratorManager::getGeneratorName ( string  $class)

Returns the registered name of the given Generator class.

Parameters
string$classFully qualified name of class that extends \pocketmine\world\generator\Generator @phpstan-param class-string<Generator> $class
Exceptions

InvalidArgumentException if the class type cannot be matched to a known alias

Definition at line 123 of file GeneratorManager.php.


The documentation for this class was generated from the following file: