Generator: Moved generator registering things to a separate GeneratorManager class

this isolates the concerns of the Generator class, and also removes cyclic dependencies between the Generator class and its descendents.
This commit is contained in:
Dylan K. Taylor
2018-06-07 13:48:01 +01:00
parent 0bca3cd481
commit 5eec683110
6 changed files with 95 additions and 60 deletions

View File

@ -29,7 +29,7 @@ use pocketmine\level\format\io\ChunkUtils;
use pocketmine\level\format\io\exception\UnsupportedChunkFormatException;
use pocketmine\level\format\SubChunk;
use pocketmine\level\generator\Flat;
use pocketmine\level\generator\Generator;
use pocketmine\level\generator\GeneratorManager;
use pocketmine\level\Level;
use pocketmine\level\LevelException;
use pocketmine\nbt\LittleEndianNBTStream;
@ -212,7 +212,7 @@ class LevelDB extends BaseLevelProvider{
//Additional PocketMine-MP fields
new CompoundTag("GameRules", []),
new ByteTag("hardcore", ($options["hardcore"] ?? false) === true ? 1 : 0),
new StringTag("generatorName", Generator::getGeneratorName($generator)),
new StringTag("generatorName", GeneratorManager::getGeneratorName($generator)),
new StringTag("generatorOptions", $options["preset"] ?? "")
]);