diff --git a/src/pocketmine/nbt/NBT.php b/src/pocketmine/nbt/NBT.php index e8fc1d857..80d60b3f7 100644 --- a/src/pocketmine/nbt/NBT.php +++ b/src/pocketmine/nbt/NBT.php @@ -308,12 +308,19 @@ class NBT{ } } - public function getLong() : int{ + public function getLong(bool $network = false) : int{ + if($network){ + return Binary::readVarLong($this->buffer, $this->offset); + } return $this->endianness === self::BIG_ENDIAN ? Binary::readLong($this->get(8)) : Binary::readLLong($this->get(8)); } - public function putLong($v){ - $this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeLong($v) : Binary::writeLLong($v); + public function putLong($v, bool $network = false){ + if($network){ + $this->buffer .= Binary::writeVarLong($v); + }else{ + $this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeLong($v) : Binary::writeLLong($v); + } } public function getFloat() : float{ diff --git a/src/pocketmine/nbt/tag/LongTag.php b/src/pocketmine/nbt/tag/LongTag.php index 867e07077..25e13582d 100644 --- a/src/pocketmine/nbt/tag/LongTag.php +++ b/src/pocketmine/nbt/tag/LongTag.php @@ -43,13 +43,11 @@ class LongTag extends NamedTag{ return NBT::TAG_Long; } - //TODO: check if this also changed to varint - public function read(NBT $nbt, bool $network = false){ - $this->value = $nbt->getLong(); + $this->value = $nbt->getLong($network); } public function write(NBT $nbt, bool $network = false){ - $nbt->putLong($this->value); + $nbt->putLong($this->value, $network); } } \ No newline at end of file diff --git a/src/raklib b/src/raklib index 75b213db2..226772184 160000 --- a/src/raklib +++ b/src/raklib @@ -1 +1 @@ -Subproject commit 75b213db26755f67726784e0d5a36608158168cd +Subproject commit 226772184b6cb3c014477feb41e55ec22850f2dd