pocketmine\level\Level::generateChunkLoaderId PHP Метод

generateChunkLoaderId() публичный статический Метод

public static generateChunkLoaderId ( pocketmine\level\ChunkLoader $loader ) : integer
$loader pocketmine\level\ChunkLoader
Результат integer
    public static function generateChunkLoaderId(ChunkLoader $loader) : int
    {
        if ($loader->getLoaderId() === 0 or $loader->getLoaderId() === null or $loader->getLoaderId() === null) {
            return self::$chunkLoaderCounter++;
        } else {
            throw new \InvalidStateException("ChunkLoader has a loader id already assigned: " . $loader->getLoaderId());
        }
    }

Usage Example

Пример #1
0
 /**
  * @param SourceInterface $interface
  * @param null            $clientID
  * @param string          $ip
  * @param integer         $port
  */
 public function __construct(SourceInterface $interface, $clientID, $ip, $port)
 {
     $this->interface = $interface;
     $this->windows = new \SplObjectStorage();
     $this->perm = new PermissibleBase($this);
     $this->namedtag = new Compound();
     $this->server = Server::getInstance();
     $this->lastBreak = PHP_INT_MAX;
     $this->ip = $ip;
     $this->port = $port;
     $this->clientID = $clientID;
     $this->loaderId = Level::generateChunkLoaderId($this);
     $this->chunksPerTick = (int) $this->server->getProperty("chunk-sending.per-tick", 4);
     $this->spawnThreshold = (int) $this->server->getProperty("chunk-sending.spawn-threshold", 56);
     $this->spawnPosition = null;
     $this->gamemode = $this->server->getGamemode();
     $this->setLevel($this->server->getDefaultLevel());
     $this->viewDistance = $this->server->getViewDistance();
     $this->newPosition = new Vector3(0, 0, 0);
     $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $this->uuid = null;
     $this->rawUUID = null;
     $this->creationTime = microtime(true);
 }
Level