getGenerator() public method

Returns the generator name
public getGenerator ( ) : string
return string
コード例 #1
0
ファイル: Level.php プロジェクト: robozeri/Yuriko-MP
 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, $name, $path, $provider)
 {
     $this->blockStates = Block::$fullList;
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     $this->autoSave = $server->getAutoSave();
     /** @var LevelProvider $provider */
     if (is_subclass_of($provider, LevelProvider::class, true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new LevelException("Provider is not a subclass of LevelProvider");
     }
     $this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.level.preparing", [$this->provider->getName()]));
     $this->generator = Generator::getGenerator($this->provider->getGenerator());
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 40);
     $this->chunkGenerationQueueSize = (int) $this->server->getProperty("chunk-generation.queue-size", 8);
     $this->chunkPopulationQueueSize = (int) $this->server->getProperty("chunk-generation.population-queue-size", 2);
     $this->chunkTickList = [];
     $this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", true);
     $this->cacheChunks = (bool) $this->server->getProperty("chunk-sending.cache-chunks", false);
     $this->timings = new LevelTimings($this);
     $this->temporalPosition = new Position(0, 0, 0, $this);
     $this->temporalVector = new Vector3(0, 0, 0);
     $this->tickRate = 1;
 }
コード例 #2
0
ファイル: Level.php プロジェクト: boybook/PocketMine-MP
 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, $name, $path, $provider)
 {
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     /** @var LevelProvider $provider */
     if (is_subclass_of($provider, "pocketmine\\level\\format\\LevelProvider", true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new \Exception("Provider is not a subclass of LevelProvider");
     }
     $this->server->getLogger()->info("Preparing level \"" . $this->provider->getName() . "\"");
     $generator = Generator::getGenerator($this->provider->getGenerator());
     $this->server->getGenerationManager()->openLevel($this, $generator, $this->provider->getGeneratorOptions());
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 3)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 80);
     $this->chunkTickList = [];
     $this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", false);
     $this->timings = new LevelTimings($this);
 }
コード例 #3
0
ファイル: Level.php プロジェクト: MateiGamingYTB/PocketEarth
 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, $name, $path, $provider)
 {
     $this->blockStates = Block::$fullList;
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     $this->autoSave = $server->getAutoSave();
     /** @var LevelProvider $provider */
     if (is_subclass_of($provider, LevelProvider::class, true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new LevelException("Provider is not a subclass of LevelProvider");
     }
     $this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.level.preparing", [$this->provider->getName()]));
     $this->generator = Generator::getGenerator($this->provider->getGenerator());
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     $this->weatherEnabled = (bool) $this->getServer()->getProperty("weather-settings.enable-weather");
     $this->weatherMinutes = $this->getServer()->getProperty("weather-settings.weather-minutes");
     if ($this->weatherMinutes === strtolower("random") || $this->weatherMinutes === null) {
         $this->weatherMinutes = mt_rand(3, 5);
     }
     if ($this->weatherEnabled === true) {
         $this->raining = $this->provider->isRaining();
         $this->rainTime = $this->provider->getRainTime();
         if ($this->rainTime <= 0) {
             $this->setRainTime($this->weatherMinutes * 20 * 60);
         }
         $this->randomWeather = mt_rand(0, 400);
         $this->thundering = $this->provider->isThundering();
         $this->thunderTime = $this->provider->getThunderTime();
         if ($this->thunderTime <= 0) {
             $this->setThunderTime($this->weatherMinutes * 20 * 60);
         }
     }
     foreach ($this->getServer()->getProperty("disable-block-ticking", []) as $id) {
         $ticked = isset($this->randomTickBlocks[$id]);
         if ($ticked === true) {
             unset($this->randomTickBlocks[$id]);
         }
     }
     $this->updateRedstoneQueue = new ReversePriorityQueue();
     $this->updateRedstoneQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 40);
     $this->chunkGenerationQueueSize = (int) $this->server->getProperty("chunk-generation.queue-size", 8);
     $this->chunkPopulationQueueSize = (int) $this->server->getProperty("chunk-generation.population-queue-size", 2);
     $this->chunkTickList = [];
     $this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", true);
     $this->cacheChunks = (bool) $this->server->getProperty("chunk-sending.cache-chunks", false);
     $this->timings = new LevelTimings($this);
     $this->temporalPosition = new Position(0, 0, 0, $this);
     $this->temporalVector = new Vector3(0, 0, 0);
     $this->temporalVector2 = new Vector3(0, 0, 0);
     $this->tickRate = 1;
 }
コード例 #4
0
ファイル: Level.php プロジェクト: xHFx/Steadfast2
 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, $name, $path, $provider)
 {
     $this->blockStates = Block::$fullList;
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     $this->autoSave = $server->getAutoSave();
     /** @var LevelProvider $provider */
     if (\is_subclass_of($provider, LevelProvider::class, \true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new LevelException("Provider is not a subclass of LevelProvider");
     }
     $this->server->getLogger()->info("Preparing level \"" . $this->provider->getName() . "\"");
     $this->generator = Generator::getGenerator($this->provider->getGenerator());
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     $this->chunkTickRadius = \min($this->server->getViewDistance(), \max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 0);
     $this->chunkTickList = [];
     $this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", \false);
     $this->timings = new LevelTimings($this);
     $this->temporalPosition = new Position(0, 0, 0, $this);
     $this->temporalVector = new Vector3(0, 0, 0);
 }
コード例 #5
0
ファイル: Level.php プロジェクト: ClearSkyTeam/ClearSky
 /**
  * Init the default level data
  *
  * @param Server $server
  * @param string $name
  * @param string $path
  * @param string $provider Class that extends LevelProvider
  *
  * @throws \Exception
  */
 public function __construct(Server $server, string $name, string $path, string $provider)
 {
     $this->blockStates = Block::$fullList;
     $this->levelId = static::$levelIdCounter++;
     $this->blockMetadata = new BlockMetadataStore($this);
     $this->server = $server;
     $this->autoSave = $server->getAutoSave();
     /** Weather Config Loader */
     $this->rainprob = $this->getServer()->getProperty("level-settings.weather.rain.possibility", 10);
     $this->raintime[] = $this->getServer()->getProperty("level-settings.weather.rain.time.min", 30);
     $this->raintime[] = $this->getServer()->getProperty("level-settings.weather.rain.time.max", 120);
     $this->rainfall[] = $this->getServer()->getProperty("level-settings.weather.rain.rainfall.min", 1000);
     $this->rainfall[] = $this->getServer()->getProperty("level-settings.weather.rain.rainfall.max", 100000);
     /** @var LevelProvider $provider */
     if (is_subclass_of($provider, LevelProvider::class, true)) {
         $this->provider = new $provider($this, $path);
     } else {
         throw new LevelException("Provider is not a subclass of LevelProvider");
     }
     $this->server->getLogger()->info($this->server->getLanguage()->translateString("pocketmine.level.preparing", [$this->provider->getName()]));
     $this->generator = Generator::getGenerator($this->provider->getGenerator());
     $this->blockOrder = $provider::getProviderOrder();
     $this->useSections = $provider::usesChunkSection();
     $this->folderName = $name;
     $this->updateQueue = new ReversePriorityQueue();
     $this->updateQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->time = (int) $this->provider->getTime();
     /** Set dimension */
     if ($server->netherName == $this->folderName) {
         $this->setDimension(self::DIMENSION_NETHER);
     } else {
         $this->setDimension(self::DIMENSION_NORMAL);
     }
     $this->gamerules = new GameRules($this->provider->getGameRules());
     $this->getGameRule("doDaylightCycle") ? $this->startTime() : $this->stopTime();
     /** Random ticking */
     foreach ($this->getServer()->getProperty("chunk-ticking.disabled-randomly-ticking-blocks", []) as $id) {
         $ticked = isset($this->randomTickBlocks[$id]);
         if ($ticked === true) {
             unset($this->randomTickBlocks[$id]);
         }
     }
     $this->updateRedstoneQueue = new ReversePriorityQueue();
     $this->updateRedstoneQueue->setExtractFlags(\SplPriorityQueue::EXTR_BOTH);
     $this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty("chunk-ticking.tick-radius", 4)));
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-ticking.per-tick", 40);
     $this->chunkGenerationQueueSize = (int) $this->server->getProperty("chunk-generation.queue-size", 8);
     $this->chunkPopulationQueueSize = (int) $this->server->getProperty("chunk-generation.population-queue-size", 2);
     $this->chunkTickList = [];
     $this->clearChunksOnTick = (bool) $this->server->getProperty("chunk-ticking.clear-tick-list", true);
     $this->cacheChunks = (bool) $this->server->getProperty("chunk-sending.cache-chunks", false);
     $this->timings = new LevelTimings($this);
     $this->temporalPosition = new Position(0, 0, 0, $this);
     $this->temporalVector = new Vector3(0, 0, 0);
     $this->tickRate = 1;
 }
コード例 #6
0
ファイル: Level.php プロジェクト: robske110/ClearSky
 /**
  * Returns the Level dimension
  *
  * @return int
  */
 public function getDimension()
 {
     return $this->provider->getGenerator() == 'nether' ? ChangeDimensionPacket::NETHER : $this->dimension;
 }