当前位置: 首页>>代码示例>>PHP>>正文


PHP Level::getId方法代码示例

本文整理汇总了PHP中pocketmine\level\Level::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Level::getId方法的具体用法?PHP Level::getId怎么用?PHP Level::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pocketmine\level\Level的用法示例。


在下文中一共展示了Level::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: blockZone

 public function blockZone(Vector3 $a, Vector3 $b, Level $level)
 {
     if (!isset($this->activeZones[$level->getId()])) {
         $this->activeZones[$level->getId()] = [];
     }
     $id = count($this->activeZones[$level->getId()]);
     $this->activeZones[$level->getId()][$id] = [$a, $b];
     $this->clearZone($level, $id);
     return $id;
 }
开发者ID:MCPEGamerJPatGitHub,项目名称:MineReset,代码行数:10,代码来源:RegionBlocker.php

示例2: __construct

 public function __construct(Level $level, FullChunk $chunk)
 {
     $this->state = true;
     $this->levelId = $level->getId();
     $this->chunk = $chunk->toFastBinary();
     $this->chunkClass = get_class($chunk);
 }
开发者ID:wsj7178,项目名称:PocketMine-MP,代码行数:7,代码来源:GenerationTask.php

示例3: __construct

 public function __construct(Level $level, Generator $generator)
 {
     $this->generator = get_class($generator);
     $this->settings = $generator->getSettings();
     $this->seed = $level->getSeed();
     $this->levelId = $level->getId();
 }
开发者ID:TexusDark,项目名称:Ananas-MP,代码行数:7,代码来源:GeneratorRegisterTask.php

示例4: __construct

 public function __construct(Level $level, Generator $generator)
 {
     $this->generator = get_class($generator);
     $this->waterHeight = $generator->getWaterHeight();
     $this->settings = serialize($generator->getSettings());
     $this->seed = $level->getSeed();
     $this->levelId = $level->getId();
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:8,代码来源:GeneratorRegisterTask.php

示例5: __construct

 public function __construct(Level $level, FullChunk $chunk)
 {
     $this->state = true;
     $this->levelId = $level->getId();
     $this->chunk = $chunk->toFastBinary();
     $this->chunkClass = get_class($chunk);
     $this->chunk00 = $level->getChunk($chunk->getX() - 1, $chunk->getZ() - 1, true)->toFastBinary();
     $this->chunk01 = $level->getChunk($chunk->getX() - 1, $chunk->getZ(), true)->toFastBinary();
     $this->chunk02 = $level->getChunk($chunk->getX() - 1, $chunk->getZ() + 1, true)->toFastBinary();
     $this->chunk10 = $level->getChunk($chunk->getX(), $chunk->getZ() - 1, true)->toFastBinary();
     $this->chunk12 = $level->getChunk($chunk->getX(), $chunk->getZ() + 1, true)->toFastBinary();
     $this->chunk20 = $level->getChunk($chunk->getX() + 1, $chunk->getZ() - 1, true)->toFastBinary();
     $this->chunk21 = $level->getChunk($chunk->getX() + 1, $chunk->getZ(), true)->toFastBinary();
     $this->chunk22 = $level->getChunk($chunk->getX() + 1, $chunk->getZ() + 1, true)->toFastBinary();
 }
开发者ID:TylerGames,项目名称:PocketMine-MP,代码行数:15,代码来源:PopulationTask.php

示例6: __construct

 public function __construct(Level $level, FullChunk $chunk)
 {
     $this->state = \true;
     $this->levelId = $level->getId();
     $this->chunk = $chunk->toFastBinary();
     $this->chunkClass = \get_class($chunk);
     for ($i = 0; $i < 9; ++$i) {
         if ($i === 4) {
             continue;
         }
         $xx = -1 + $i % 3;
         $zz = -1 + (int) ($i / 3);
         $ck = $level->getChunk($chunk->getX() + $xx, $chunk->getZ() + $zz, \false);
         $this->{"chunk{$i}"} = $ck !== \null ? $ck->toFastBinary() : \null;
     }
 }
开发者ID:xpyctum,项目名称:PocketMinePlusPlus,代码行数:16,代码来源:PopulationTask.php

示例7: __construct

 public function __construct(Level $level, Chunk $chunk)
 {
     $this->levelId = $level->getId();
     $this->chunk = $chunk->toFastBinary();
     $this->chunkX = $chunk->getX();
     $this->chunkZ = $chunk->getZ();
     $tiles = "";
     $nbt = new NBT(NBT::LITTLE_ENDIAN);
     foreach ($chunk->getTiles() as $tile) {
         if ($tile instanceof Spawnable) {
             $nbt->setData($tile->getSpawnCompound());
             $tiles .= $nbt->write();
         }
     }
     $this->tiles = $tiles;
 }
开发者ID:iTXTech,项目名称:Genisys,代码行数:16,代码来源:ChunkRequestTask.php

示例8: generateLevel

 /**
  * Generates a new level if it does not exists
  *
  * @param string $name
  * @param int    $seed
  * @param string $generator Class name that extends pocketmine\level\generator\Generator
  * @param array  $options
  *
  * @return bool
  */
 public function generateLevel($name, $seed = null, $generator = null, $options = [])
 {
     if (trim($name) === "" or $this->isLevelGenerated($name)) {
         return false;
     }
     $seed = $seed === null ? PHP_INT_SIZE === 8 ? unpack("N", @Utils::getRandomBytes(4, false))[1] << 32 >> 32 : unpack("N", @Utils::getRandomBytes(4, false))[1] : (int) $seed;
     if ($generator !== null and class_exists($generator) and is_subclass_of($generator, Generator::class)) {
         $generator = new $generator($options);
     } else {
         $options["preset"] = $this->getConfigString("generator-settings", "");
         $generator = Generator::getGenerator($this->getLevelType());
     }
     if (($provider = LevelProviderManager::getProviderByName($providerName = $this->getProperty("level-settings.default-format", "mcregion"))) === null) {
         $provider = LevelProviderManager::getProviderByName($providerName = "mcregion");
     }
     try {
         $path = $this->getDataPath() . "worlds/" . $name . "/";
         /** @var \pocketmine\level\format\LevelProvider $provider */
         $provider::generate($path, $name, $seed, $generator, $options);
         $level = new Level($this, $name, $path, $provider);
         $this->levels[$level->getId()] = $level;
         $level->initLevel();
     } catch (\Exception $e) {
         $this->logger->error("Could not generate level \"" . $name . "\": " . $e->getMessage());
         if ($this->logger instanceof MainLogger) {
             $this->logger->logException($e);
         }
         return false;
     }
     $this->getPluginManager()->callEvent(new LevelInitEvent($level));
     $this->getPluginManager()->callEvent(new LevelLoadEvent($level));
     $this->getLogger()->notice("Spawn terrain for level \"{$name}\" is being generated in the background");
     $centerX = $level->getSpawnLocation()->getX() >> 4;
     $centerZ = $level->getSpawnLocation()->getZ() >> 4;
     $order = [];
     for ($X = -4; $X <= 4; ++$X) {
         for ($Z = -4; $Z <= 4; ++$Z) {
             $distance = $X ** 2 + $Z ** 2;
             $chunkX = $X + $centerX;
             $chunkZ = $Z + $centerZ;
             $index = PHP_INT_SIZE === 8 ? ($chunkX & 0xffffffff) << 32 | $chunkZ & 0xffffffff : $chunkX . ":" . $chunkZ;
             $order[$index] = $distance;
         }
     }
     asort($order);
     $chunkX = $chunkZ = null;
     foreach ($order as $index => $distance) {
         if (PHP_INT_SIZE === 8) {
             $chunkX = $index >> 32 << 32 >> 32;
             $chunkZ = ($index & 0xffffffff) << 32 >> 32;
         } else {
             list($chunkX, $chunkZ) = explode(":", $index);
             $chunkX = (int) $chunkX;
             $chunkZ = (int) $chunkZ;
         }
         $level->generateChunk($chunkX, $chunkZ, true);
     }
     return true;
 }
开发者ID:ZenaGamingsky,项目名称:Steadfast2,代码行数:69,代码来源:Server.php

示例9: generateLevel

 /**
  * Generates a new level if it does not exists
  *
  * @param string $name
  * @param int    $seed
  * @param string $generator Class name that extends pocketmine\level\generator\Generator
  * @param array  $options
  *
  * @return bool
  */
 public function generateLevel($name, $seed = null, $generator = null, $options = [])
 {
     if (trim($name) === "" or $this->isLevelGenerated($name)) {
         return false;
     }
     $seed = $seed === null ? Binary::readInt(@Utils::getRandomBytes(4, false)) : (int) $seed;
     if ($generator !== null and class_exists($generator) and is_subclass_of($generator, Generator::class)) {
         $generator = new $generator($options);
     } else {
         $options["preset"] = $this->getConfigString("generator-settings", "");
         $generator = Generator::getGenerator($this->getLevelType());
     }
     if (($provider = LevelProviderManager::getProviderByName($providerName = $this->getProperty("level-settings.default-format", "mcregion"))) === null) {
         $provider = LevelProviderManager::getProviderByName($providerName = "mcregion");
     }
     try {
         $path = $this->getDataPath() . "worlds/" . $name . "/";
         /** @var \pocketmine\level\format\LevelProvider $provider */
         $provider::generate($path, $name, $seed, $generator, $options);
         $level = new Level($this, $name, $path, $provider);
         $this->levels[$level->getId()] = $level;
         $level->initLevel();
     } catch (\Exception $e) {
         $this->logger->error("Could not generate level \"" . $name . "\": " . $e->getMessage());
         if ($this->logger instanceof MainLogger) {
             $this->logger->logException($e);
         }
         return false;
     }
     $this->getPluginManager()->callEvent(new LevelInitEvent($level));
     $this->getPluginManager()->callEvent(new LevelLoadEvent($level));
     $this->getLogger()->notice("Spawn terrain for level \"{$name}\" is being generated in the background");
     $radiusSquared = ($this->getViewDistance() + 1) / M_PI;
     $radius = ceil(sqrt($radiusSquared));
     $centerX = $level->getSpawnLocation()->getX() >> 4;
     $centerZ = $level->getSpawnLocation()->getZ() >> 4;
     $order = [];
     for ($X = -$radius; $X <= $radius; ++$X) {
         for ($Z = -$radius; $Z <= $radius; ++$Z) {
             $distance = $X ** 2 + $Z ** 2;
             if ($distance > $radiusSquared) {
                 continue;
             }
             $chunkX = $X + $centerX;
             $chunkZ = $Z + $centerZ;
             $index = Level::chunkHash($chunkX, $chunkZ);
             $order[$index] = $distance;
         }
     }
     asort($order);
     $chunkX = $chunkZ = null;
     foreach ($order as $index => $distance) {
         Level::getXZ($index, $chunkX, $chunkZ);
         $level->generateChunk($chunkX, $chunkZ);
     }
     return true;
 }
开发者ID:hlogeon,项目名称:PocketMineJs-MP,代码行数:67,代码来源:Server.php

示例10: setLevel

 public function setLevel(Level $level)
 {
     $this->levelId = $level !== null ? $level->getId() : -1;
     return $this;
 }
开发者ID:kniffo80,项目名称:Genisys,代码行数:5,代码来源:WeakPosition.php

示例11: generateLevel

 /**
  * Generates a new level if it does not exists
  *
  * @param string $name
  * @param int    $seed
  * @param string $generator Class name that extends pocketmine\level\generator\Noise
  * @param array  $options
  *
  * @return bool
  */
 public function generateLevel($name, $seed = \null, $generator = \null, $options = [])
 {
     if (\trim($name) === "" or $this->isLevelGenerated($name)) {
         return \false;
     }
     $seed = $seed === \null ? \PHP_INT_SIZE === 8 ? \unpack("N", @Utils::getRandomBytes(4, \false))[1] << 32 >> 32 : \unpack("N", @Utils::getRandomBytes(4, \false))[1] : (int) $seed;
     if (!isset($options["preset"])) {
         $options["preset"] = $this->getConfigString("generator-settings", "");
     }
     if (!($generator !== \null and \class_exists($generator, \true) and \is_subclass_of($generator, Generator::class))) {
         $generator = Generator::getGenerator($this->getLevelType());
     }
     if (($provider = LevelProviderManager::getProviderByName($providerName = $this->getProperty("level-settings.default-format", "mcregion"))) === \null) {
         $provider = LevelProviderManager::getProviderByName($providerName = "mcregion");
     }
     try {
         $path = $this->getDataPath() . "worlds/" . $name . "/";
         /** @var \pocketmine\level\format\LevelProvider $provider */
         $provider::generate($path, $name, $seed, $generator, $options);
         $level = new Level($this, $name, $path, $provider);
         $this->levels[$level->getId()] = $level;
         $level->initLevel();
         $level->setTickRate($this->baseTickRate);
     } catch (\Exception $e) {
         $this->logger->error($this->getLanguage()->translateString("pocketmine.level.generateError", [$name, $e->getMessage()]));
         if ($this->logger instanceof MainLogger) {
             $this->logger->logException($e);
         }
         return \false;
     }
     $this->getPluginManager()->callEvent(new LevelInitEvent($level));
     $this->getPluginManager()->callEvent(new LevelLoadEvent($level));
     $this->getLogger()->notice($this->getLanguage()->translateString("pocketmine.level.backgroundGeneration", [$name]));
     $centerX = $level->getSpawnLocation()->getX() >> 4;
     $centerZ = $level->getSpawnLocation()->getZ() >> 4;
     $order = [];
     for ($X = -3; $X <= 3; ++$X) {
         for ($Z = -3; $Z <= 3; ++$Z) {
             $distance = $X ** 2 + $Z ** 2;
             $chunkX = $X + $centerX;
             $chunkZ = $Z + $centerZ;
             $index = \PHP_INT_SIZE === 8 ? ($chunkX & 4294967295.0) << 32 | $chunkZ & 4294967295.0 : $chunkX . ":" . $chunkZ;
             $order[$index] = $distance;
         }
     }
     \asort($order);
     foreach ($order as $index => $distance) {
         if (\PHP_INT_SIZE === 8) {
             $chunkX = $index >> 32 << 32 >> 32;
             $chunkZ = ($index & 4294967295.0) << 32 >> 32;
         } else {
             list($chunkX, $chunkZ) = \explode(":", $index);
             $chunkX = (int) $chunkX;
             $chunkZ = (int) $chunkZ;
         }
         $level->populateChunk($chunkX, $chunkZ, \true);
     }
     return \true;
 }
开发者ID:VonHirsch,项目名称:PocketMine-0.13.0,代码行数:69,代码来源:Server.php

示例12: requestChunk

 public function requestChunk(Level $level, $chunkX, $chunkZ)
 {
     $buffer = chr(GenerationManager::PACKET_REQUEST_CHUNK) . Binary::writeInt($level->getId()) . Binary::writeInt($chunkX) . Binary::writeInt($chunkZ);
     $this->generationThread->pushMainToThreadPacket($buffer);
 }
开发者ID:rryy,项目名称:PocketMine-MP,代码行数:5,代码来源:GenerationRequestManager.php

示例13: sendLevelInfo

 /**
  * @param CommandSender $sender
  * @param Level $level
  */
 public function sendLevelInfo(CommandSender $sender, Level $level)
 {
     $sender->sendMessage("Name: " . $level->getName());
     $sender->sendMessage("Id: " . $level->getId());
     $sender->sendMessage("Entities: " . count($level->getEntities()));
     $sender->sendMessage("Players: " . count($level->getPlayers()));
     $sender->sendMessage("Tiles: " . count($level->getTiles()));
     $sender->sendMessage("Chunks: " . count($level->getChunks()));
     $sender->sendMessage("Loaders: " . count($level->getLoaders()));
     $sender->sendMessage("Spawn: " . $level->getSafeSpawn()->getFloorX() . ":" . $level->getSafeSpawn()->getFloorY() . ":" . $level->getSafeSpawn()->getFloorZ());
     $sender->sendMessage("Time: " . $level->getTime());
     $sender->sendMessage("Tick-rate: " . $level->getTickRate());
     $sender->sendMessage("Tick-rate-time: " . $level->getTickRateTime());
     $sender->sendMessage("Seed: " . $level->getSeed());
     $sender->sendMessage("Is-auto-saving: " . ($level->getAutoSave() ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $sender->sendMessage("Is-generated: " . ($level->getServer()->isLevelGenerated($level->getName()) ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
     $sender->sendMessage("Is-loaded: " . ($level->getServer()->isLevelLoaded($level->getName()) ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
 }
开发者ID:happyexceed,项目名称:PocketMine-Plugins-1,代码行数:22,代码来源:InfoFetcher.php

示例14: requestChunk

 public function requestChunk(Level $level, $chunkX, $chunkZ)
 {
     $this->generationManager->enqueueChunk($level->getId(), $chunkX, $chunkZ);
 }
开发者ID:rryy,项目名称:PocketMine-MP,代码行数:4,代码来源:GenerationInstanceManager.php

示例15: __construct

 public function __construct(Level $level)
 {
     $this->levelId = $level->getId();
 }
开发者ID:kazuemon,项目名称:NIGHTMARE,代码行数:4,代码来源:GeneratorUnregisterTask.php


注:本文中的pocketmine\level\Level::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。