13declare(strict_types=1);
15namespace pocketmine\network\mcpe\protocol\serializer;
25 return $this->buffer->getLShort();
29 return $this->buffer->getSignedLShort();
32 public function writeShort(
int $v) : void{
33 $this->buffer->putLShort($v);
37 return $this->buffer->getVarInt();
40 public function writeInt(
int $v) : void{
41 $this->buffer->putVarInt($v);
45 return $this->buffer->getVarLong();
48 public function writeLong(
int $v) : void{
49 $this->buffer->putVarLong($v);
53 return $this->buffer->get(self::checkReadStringLength($this->buffer->getUnsignedVarInt()));
57 $this->buffer->putUnsignedVarInt(self::checkWriteStringLength(strlen($v)));
58 $this->buffer->put($v);
62 return $this->buffer->getLFloat();
65 public function writeFloat(
float $v) : void{
66 $this->buffer->putLFloat($v);
70 return $this->buffer->getLDouble();
73 public function writeDouble(
float $v) : void{
74 $this->buffer->putLDouble($v);
78 $len = $this->readInt();
80 throw new NbtDataException(
"Array length cannot be less than zero ($len < 0)");
83 for($i = 0; $i < $len; ++$i){
84 $ret[] = $this->readInt();
91 $this->writeInt(count($array));
92 foreach($array as $v){
writeIntArray(array $array)