php pocketmine-level-format-FullChunk类(方法)实例源码

下面列出了php pocketmine-level-format-FullChunk 类(方法)源码代码实例,从而了解它的用法。

作者:wsj717    项目:PocketMine-M   
public function __construct(Level $level, FullChunk $chunk)
 {
     $this->state = true;
     $this->levelId = $level->getId();
     $this->chunk = $chunk->toFastBinary();
     $this->chunkClass = get_class($chunk);
 }

作者:TylerGame    项目:PocketMine-M   
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();
 }

作者:xpyctu    项目:PocketMinePlusPlu   
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;
     }
 }

作者:boyboo    项目:PocketMine-M   
public function __construct(FullChunk $chunk, Compound $nbt)
 {
     if ($chunk === null or $chunk->getProvider() === null) {
         throw new \Exception("Invalid garbage Chunk given to Tile");
     }
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->namedtag = $nbt;
     $this->closed = false;
     $this->name = "";
     $this->lastUpdate = microtime(true);
     $this->id = Tile::$tileCount++;
     $this->x = (int) $this->namedtag["x"];
     $this->y = (int) $this->namedtag["y"];
     $this->z = (int) $this->namedtag["z"];
     $this->chunk->addTile($this);
     $this->getLevel()->addTile($this);
     $this->tickTimer = Timings::getTileEntityTimings($this);
 }

作者:xpyctu    项目:PocketMinePlusPlu   
public function setChunk($chunkX, $chunkZ, FullChunk $chunk)
 {
     if (!$chunk instanceof Chunk) {
         throw new ChunkException("Invalid Chunk class");
     }
     $chunk->setProvider($this);
     $chunk->setX($chunkX);
     $chunk->setZ($chunkZ);
     if (isset($this->chunks[$index = \PHP_INT_SIZE === 8 ? ($chunkX & 0xffffffff) << 32 | $chunkZ & 0xffffffff : $chunkX . ":" . $chunkZ]) and $this->chunks[$index] !== $chunk) {
         $this->unloadChunk($chunkX, $chunkZ, \false);
     }
     $this->chunks[$index] = $chunk;
 }

作者:boyboo    项目:PocketMine-M   
protected function receiveChunk($levelID, FullChunk $chunk)
 {
     if ($this->needsChunk[$levelID] !== null) {
         if ($this->needsChunk[$levelID][0] === $chunk->getX() and $this->needsChunk[$levelID][1] === $chunk->getZ()) {
             $this->needsChunk[$levelID] = $chunk;
         }
     }
     //TODO: set new received chunks
 }

作者:rry    项目:PocketMine-M   
public function writeChunk(FullChunk $chunk)
 {
     $this->saveChunk($chunk->getX() - $this->getX() * 32, $chunk->getZ() - $this->getZ() * 32, $chunk->toBinary());
 }

作者:Hydreo    项目:PMSoft23   
public function setChunk($chunkX, $chunkZ, FullChunk $chunk)
 {
     if (!$chunk instanceof Chunk) {
         throw new ChunkException("Invalid Chunk class");
     }
     $chunk->setProvider($this);
     self::getRegionIndex($chunkX, $chunkZ, $regionX, $regionZ);
     $this->loadRegion($regionX, $regionZ);
     $chunk->setX($chunkX);
     $chunk->setZ($chunkZ);
     if (isset($this->chunks[$index = PHP_INT_SIZE === 8 ? ($chunkX & 4294967295.0) << 32 | $chunkZ & 4294967295.0 : $chunkX . ":" . $chunkZ]) and $this->chunks[$index] !== $chunk) {
         $this->unloadChunk($chunkX, $chunkZ, false);
     }
     $this->chunks[$index] = $chunk;
 }

作者:RedstoneAlmeid    项目:Steadfast   
public function generateChunkCallback($x, $z, FullChunk $chunk)
 {
     $oldChunk = $this->getChunk($x, $z, false);
     unset($this->chunkGenerationQueue[PHP_INT_SIZE === 8 ? ($x & 4294967295.0) << 32 | $z & 4294967295.0 : $x . ":" . $z]);
     $chunk->setProvider($this->provider);
     $this->setChunk($x, $z, $chunk);
     $chunk = $this->getChunk($x, $z, false);
     if ($chunk !== null and ($oldChunk === null or $oldChunk->isPopulated() === false) and $chunk->isPopulated()) {
         $this->server->getPluginManager()->callEvent(new ChunkPopulateEvent($chunk));
     }
 }

作者:xpyctu    项目:PocketMinePlusPlu   
public function writeChunk(FullChunk $chunk)
 {
     $this->lastUsed = \time();
     $chunkData = $chunk->toBinary();
     if ($chunkData !== \false) {
         $this->saveChunk($chunk->getX() - $this->getX() * 32, $chunk->getZ() - $this->getZ() * 32, $chunkData);
     }
 }

作者:ZenaGamingsk    项目:Steadfast   
/**
  * @param int       $chunkX
  * @param int       $chunkZ
  * @param FullChunk $chunk
  */
 public function setChunk($chunkX, $chunkZ, FullChunk $chunk)
 {
     $this->chunks[$index = PHP_INT_SIZE === 8 ? ($chunkX & 0xffffffff) << 32 | $chunkZ & 0xffffffff : $chunkX . ":" . $chunkZ] = $chunk;
     $this->changes[$index] = $chunk;
     if ($chunk->isPopulated()) {
         //TODO: Queue to be sent
     }
 }

作者:boyboo    项目:PocketMine-M   
public function setChunk($chunkX, $chunkZ, FullChunk $chunk)
 {
     if (!$chunk instanceof Chunk) {
         throw new \Exception("Invalid Chunk class");
     }
     $chunk->setProvider($this);
     if ($chunk->isPopulated() === false) {
         $this->unloadChunk($chunkX, $chunkZ, false);
         $regionX = $regionZ = null;
         self::getRegionIndex($chunkX, $chunkZ, $regionX, $regionZ);
         $this->loadRegion($regionX, $regionZ);
         $region = $this->getRegion($regionX, $regionZ);
         $region->removeChunk($chunkX - $region->getX() * 32, $chunkZ - $region->getZ() * 32);
         $this->loadChunk($chunkX, $chunkZ);
     } else {
         $chunk->setX($chunkX);
         $chunk->setZ($chunkZ);
         $this->chunks[Level::chunkHash($chunkX, $chunkZ)] = $chunk;
         //$this->saveChunk($chunkX, $chunkZ);
     }
 }

作者:Edwardthedog    项目:Steadfast   
public function setChunk($chunkX, $chunkZ, FullChunk $chunk)
 {
     if (!$chunk instanceof Chunk) {
         throw new ChunkException("Invalid Chunk class");
     }
     $chunk->setProvider($this);
     self::getRegionIndex($chunkX, $chunkZ, $regionX, $regionZ);
     $this->loadRegion($regionX, $regionZ);
     $chunk->setX($chunkX);
     $chunk->setZ($chunkZ);
     $this->chunks[\PHP_INT_SIZE === 8 ? ($chunkX & 0xffffffff) << 32 | $chunkZ & 0xffffffff : $chunkX . ":" . $chunkZ] = $chunk;
 }

作者:ken7773    项目:PocketMine-0.13.   
public function setChunk($chunkX, $chunkZ, FullChunk $chunk)
 {
     if (!$chunk instanceof Chunk) {
         throw new ChunkException("Invalid Chunk class");
     }
     $chunk->setProvider($this);
     $chunk->setX($chunkX);
     $chunk->setZ($chunkZ);
     if (isset($this->chunks[$index = ($chunkX & 4294967295.0) << 32 | $chunkZ & 4294967295.0]) and $this->chunks[$index] !== $chunk) {
         $this->unloadChunk($chunkX, $chunkZ, \false);
     }
     $this->chunks[$index] = $chunk;
 }

作者:hlogeo    项目:PocketMineJs-M   
public function generateChunkCallback($x, $z, FullChunk $chunk)
 {
     $oldChunk = $this->getChunk($x, $z, false);
     unset($this->chunkGenerationQueue[Level::chunkHash($x, $z)]);
     $chunk->setProvider($this->provider);
     $this->setChunk($x, $z, $chunk);
     $chunk = $this->getChunk($x, $z, false);
     if ($chunk !== null and ($oldChunk === null or $oldChunk->isPopulated() === false) and $chunk->isPopulated()) {
         $this->server->getPluginManager()->callEvent(new ChunkPopulateEvent($chunk));
     }
 }

作者:NewDelio    项目:PocketMine-0.13.   
public function onChunkChanged(FullChunk $chunk)
 {
     $this->loadQueue[Level::chunkHash($chunk->getX(), $chunk->getZ())] = abs(($this->x >> 4) - $chunk->getX()) + abs(($this->z >> 4) - $chunk->getZ());
 }

作者:xpyctu    项目:PocketMinePlusPlu   
/**
  * @param FullChunk $chunk
  */
 public function __construct(FullChunk $chunk)
 {
     parent::__construct($chunk->getProvider()->getLevel());
     $this->chunk = $chunk;
 }

作者:hlogeo    项目:PocketMineJs-M   
/**
  * @param int       $chunkX
  * @param int       $chunkZ
  * @param FullChunk $chunk
  */
 public function setChunk($chunkX, $chunkZ, FullChunk $chunk)
 {
     $this->chunks[$index = Level::chunkHash($chunkX, $chunkZ)] = $chunk;
     $this->changes[$index] = $chunk;
     if ($chunk->isPopulated()) {
         //TODO: Queue to be sent
     }
 }

作者:ClearSkyTea    项目:ClearSk   
public function __construct(FullChunk $chunk, CompoundTag $nbt)
 {
     assert($chunk !== null and $chunk->getProvider() !== null);
     $this->timings = Timings::getTileEntityTimings($this);
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->namedtag = $nbt;
     $this->name = "";
     $this->lastUpdate = microtime(true);
     $this->id = Tile::$tileCount++;
     $this->x = (int) $this->namedtag["x"];
     $this->y = (int) $this->namedtag["y"];
     $this->z = (int) $this->namedtag["z"];
     $this->chunk->addTile($this);
     $this->getLevel()->addTile($this);
     $this->tickTimer = Timings::getTileEntityTimings($this);
 }

作者:xpyctu    项目:PocketMinePlusPlu   
public function onChunkChanged(FullChunk $chunk)
 {
     $this->loadQueue[($chunk->getX() & 0xffffffff) << 32 | $chunk->getZ() & 0xffffffff] = \abs(($this->x >> 4) - $chunk->getX()) + \abs(($this->z >> 4) - $chunk->getZ());
 }


问题


面经


文章

微信
公众号

扫码关注公众号