1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved BossBar now not worked correctly

Discussion in 'Development' started by Error202, Apr 24, 2019.

  1. Error202

    Error202 Spider Jockey

    Messages:
    39
    After update to 1.11.0 function for set title on boss bar not worked...
    Why?

    PHP:
    public static function setTitle(string $titleint $eid$players = []){
            if (!
    count(Server::getInstance()->getOnlinePlayers()) > 0) return;
            
    $npk = new SetEntityDataPacket(); 
            
    $npk->metadata = [Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING$title]];
            
    $npk->entityRuntimeId $eid;
            
    Server::getInstance()->broadcastPacket($players$npk);
            
    $bpk = new BossEventPacket(); // This updates the bar
            
    $bpk->bossEid $eid;
            
    $bpk->eventType BossEventPacket::TYPE_SHOW;
            
    $bpk->title $title;
            
    $bpk->healthPercent 1;
            
    $bpk->unknownShort 0;
            
    $bpk->color 0;
            
    $bpk->overlay 0;
            
    $bpk->playerEid 0;
            
    Server::getInstance()->broadcastPacket($players$bpk);
        }
     
  2. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    I don’t have any issues with mine. Could you maybe show us your error?
     
  3. TwistedAsylumMC

    TwistedAsylumMC Slime

    Messages:
    96
    GitHub:
    twistedasylummc
    In 1.11 many people have experienced problems with bossbars, hopefully they will be fixed soon / someone has a fix for them. I don't think they work for anyone in 1.11
     
  4. Error202

    Error202 Spider Jockey

    Messages:
    39
    if I change
    PHP:
    $bpk->eventType BossEventPacket::TYPE_SHOW;
    to
    PHP:
    $bpk->eventType BossEventPacket::TYPE_TITLE;
    it worked
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.