x, $pos->y, $pos->z); $this->text = $text; $this->title = $title; } public function setText($text){ $this->text = $text; } public function setTitle($title){ $this->title = $title; } public function encode(){ $p = []; if($this->entityId === null){ $this->entityId = bcadd("1095216660480", mt_rand(0, 0x7fffffff)); //No conflict with other things }else{ $pk0 = new RemovePlayerPacket(); $pk0->eid = $this->entityId; $pk0->clientID = $this->entityId; $p[] = $pk0; } $pk = new AddPlayerPacket(); $pk->eid = $this->entityId; $pk->username = $this->title . "\n" . $this->text; $pk->clientID = $this->entityId; $pk->x = $this->x; $pk->y = $this->y - 2; $pk->z = $this->z; $pk->yaw = 0; $pk->pitch = 0; $pk->item = 0; $pk->meta = 0; $pk->metadata = [ Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE, 1 << Entity::DATA_FLAG_INVISIBLE], Entity::DATA_AIR => [Entity::DATA_TYPE_SHORT, 300], Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE, 1] ]; $p[] = $pk; return $pk; } }