public function read($buffer, $doMultiple = false)
{
$this->offset = 0;
$this->buffer = $buffer;
$this->data = $this->readTag();
if ($doMultiple and $this->offset < strlen($this->buffer)) {
$this->data = [$this->data];
do {
$this->data[] = $this->readTag();
} while ($this->offset < strlen($this->buffer));
}
$this->buffer = "";
}
private static function parseCompoundTag(string $tag) : CompoundTag { if (self::$cachedParser === null) { self::$cachedParser = new NBT(NBT::LITTLE_ENDIAN); } self::$cachedParser->read($tag); return self::$cachedParser->getData(); }