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 isInvisible(){ return $this->invisible; } public function setInvisible($value = true){ $this->invisible = (bool) $value; } public function encode(){ $p = []; if($this->entityId === null){ $this->entityId = Entity::$entityCount++; }else{ $pk0 = new RemoveEntityPacket(); $pk0->entityUniqueId = $this->entityId; $p[] = $pk0; } if(!$this->invisible){ $pk = new AddEntityPacket(); $pk->entityRuntimeId = $this->entityId; $pk->type = ItemEntity::NETWORK_ID; $pk->position = $this->asVector3()->subtract(0, 0.75, 0); $pk->yaw = 0; $pk->pitch = 0; $flags = ( (1 << Entity::DATA_FLAG_CAN_SHOW_NAMETAG) | (1 << Entity::DATA_FLAG_ALWAYS_SHOW_NAMETAG) | (1 << Entity::DATA_FLAG_IMMOBILE) ); $pk->metadata = [ Entity::DATA_FLAGS => [Entity::DATA_TYPE_LONG, $flags], Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING, $this->title . ($this->text !== "" ? "\n" . $this->text : "")] ]; $p[] = $pk; } return $p; } }