本文整理汇总了PHP中pocketmine\utils\Binary::writeLInt方法的典型用法代码示例。如果您正苦于以下问题:PHP Binary::writeLInt方法的具体用法?PHP Binary::writeLInt怎么用?PHP Binary::writeLInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pocketmine\utils\Binary
的用法示例。
在下文中一共展示了Binary::writeLInt方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: putLInt
public function putLInt($v)
{
$this->buffer .= Binary::writeLInt($v);
}
示例2: chunkIndex
public static function chunkIndex($chunkX, $chunkZ)
{
return Binary::writeLInt($chunkX) . Binary::writeLInt($chunkZ);
}
示例3: writeChunk
public function writeChunk($X, $Z)
{
$X = (int) $X;
$Z = (int) $Z;
if (!isset($this->map[$X][$Z])) {
return false;
}
$chunk = "";
foreach ($this->map[$X][$Z] as $section => $data) {
for ($i = 0; $i < 256; ++$i) {
$chunk .= $data[$i];
}
}
return Binary::writeLInt(strlen($chunk)) . $chunk;
}
示例4: writePacket
private function writePacket($client, $requestID, $packetType, $payload)
{
$pk = Binary::writeLInt((int) $requestID) . Binary::writeLInt((int) $packetType) . $payload . "";
//Terminate payload and packet
return socket_write($client, Binary::writeLInt(strlen($pk)) . $pk);
}
示例5: putInt
public function putInt($v)
{
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeInt($v) : Binary::writeLInt($v);
}
示例6: onRun
public function onRun()
{
$orderedIds = "";
$orderedData = "";
$orderedSkyLight = "";
$orderedLight = "";
$ids = "";
$meta = "";
$blockLight = "";
$skyLight = "";
foreach ($this->sections as $section) {
$ids .= $section->getIdArray();
$meta .= $section->getDataArray();
$blockLight .= $section->getLightArray();
$skyLight .= $section->getSkyLightArray();
}
for ($x = 0; $x < 16; ++$x) {
for ($z = 0; $z < 16; ++$z) {
$orderedIds .= $this->getColumn($ids, $x, $z);
$orderedData .= $this->getHalfColumn($meta, $x, $z);
$orderedSkyLight .= $this->getHalfColumn($skyLight, $x, $z);
$orderedLight .= $this->getHalfColumn($blockLight, $x, $z);
}
}
$biomeColors = pack("N*", ...$this->biomeColors);
$ordered = zlib_encode(Binary::writeLInt($this->chunkX) . Binary::writeLInt($this->chunkZ) . $orderedIds . $orderedData . $orderedSkyLight . $orderedLight . $this->biomeIds . $biomeColors . $this->tiles, ZLIB_ENCODING_DEFLATE, $this->compressionLevel);
$this->setResult($ordered);
}
示例7: requestChunkTask
public function requestChunkTask($x, $z)
{
$chunk = $this->getChunk($x, $z, false);
if (!$chunk instanceof Chunk) {
throw new \Exception("Invalid Chunk sent");
}
$tiles = "";
$nbt = new NBT(NBT::LITTLE_ENDIAN);
foreach ($chunk->getTiles() as $tile) {
if ($tile instanceof Spawnable) {
$nbt->setData($tile->getSpawnCompound());
$tiles .= $nbt->write();
}
}
$biomeColors = pack("N*", ...$chunk->getBiomeColorArray());
$ordered = zlib_encode(Binary::writeLInt($x) . Binary::writeLInt($z) . $chunk->getBlockIdArray() . $chunk->getBlockDataArray() . $chunk->getBlockSkyLightArray() . $chunk->getBlockLightArray() . $chunk->getBiomeIdArray() . $biomeColors . $tiles, ZLIB_ENCODING_DEFLATE, Level::$COMPRESSION_LEVEL);
$this->getLevel()->chunkRequestCallback($x, $z, $ordered);
return null;
}
示例8: putInt
public function putInt($v, bool $network = false)
{
if ($network === true) {
$this->buffer .= Binary::writeVarInt($v);
} else {
$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeInt($v) : Binary::writeLInt($v);
}
}
示例9: putInt
public function putInt($int)
{
$this->buffer .= Binary::writeLInt($int);
}