i'm trying to send a boss bar as a test but it freezes the client. Here are the options im setting PHP: $bossPacket = new BossEventPacket();$bossPacket->bossEid = 0;$bossPacket->eventType = 0; //SHOW$bossPacket->title = "Wither";$bossPacket->healthPercent = 1;$bossPacket->color = 0;$bossPacket->playerEid = (player eid which i inserted manually, i'll make it automated later)
Yeah but what is the minimum amount of code that i need to spawn it? i see BossBarAPI but it sets lots of seemingly useless metadata
I'm not sure about this, but I think you only want this Entity:ATA_LEAD_HOLDER_EID Entity:ATA_NAMETAG in metadata to create the bossbar
You did it right, let me rewrite it a bit. PHP: $pk = new BossEventPacket();$pk->bossEid = $bossEid;$pk->eventType = BossEventPacket::TYPE_SHOW;$pk->healthPercent = 1;$pk->title = ""; $bossEid has to be the Entity::getId() of any entity provided it is spawned to the player. But since you wanted minimal code, you can send an AddEntityPacket() to the client. PHP: $pk = new AddEntityPacket();$pk->type = Entity::ZOMBIE;$pk->entityRuntimeId = $bossEid = Entity::$entityCount++:$pk->position = new Vector3();$pk->metadata[Entity::DATA_NAMETAG] = [Entity::DATA_TYPE_STRING, "Title for the bossbar"]; I'd say send the AddEntityPacket before BossEventPacket, but it should work irrespective of the order of packets. P.S: BossEventPacket->bossEid and BossEventPacket->eventType are mandatory fields. The rest of the fields depend upon the value of BossEventPacket->eventType. For example, in your case (BossEventPacket::TYPE_SHOW), the other mandatory fields would be BossEventPacket->title and BossEventPacket->healthPercent. Check BossEventPacket::encodePayload() for mandatory fields on the basis of BossEventPacket::$eventType.