protected function writePosition(Position $pos) { $this->buffer .= Bin::writeInt($pos->getX() >> 4); $this->buffer .= Bin::writeInt($pos->getZ() >> 4); $this->buffer .= Bin::writeByte(($pos->getX() & 0xf) << 4 & ($pos->getZ() & 0xf)); $this->buffer .= Bin::writeByte(strlen($pos->getLevel()->getName())); $this->buffer .= $pos->getLevel()->getName(); }
protected function readString($lengthPointer = 1) { $length = Bin::readBin($this->read($lengthPointer)); return $this->read($length); }