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

Solved Having problems with BossBar.

Discussion in 'Development' started by EnderKenji, Jun 11, 2017.

  1. EnderKenji

    EnderKenji Creeper

    Messages:
    2
    GitHub:
    EnderKenji
    Can someone help,

    This is the code in BossBarAPI, when addBossBar function is executed, bossbar is spawned normally, but the sky turns grey (like boss mode), any help to make the sky clear?


    PHP:
    public function addBossBar($playersstring $title$ticks null){
            if(empty(
    $players))
                return 
    null;

            
    $eid 99;

            
    $packet = new AddEntityPacket();
            
    $packet->entityRuntimeId $eid;
            
    $packet->type 52;
            
    $packet->yaw 0;
            
    $packet->pitch 0;
            
    $packet->speedX 0;
            
    $packet->speedY 0;
            
    $packet->speedZ 0;
            
    $packet->metadata = [Entity::DATA_LEAD_HOLDER_EID => [Entity::DATA_TYPE_LONG, -1], Entity::DATA_FLAGS => [Entity::DATA_TYPE_LONG<< Entity::DATA_FLAG_SILENT << Entity::DATA_FLAG_INVISIBLE << Entity::DATA_FLAG_NO_AI], Entity::DATA_SCALE => [Entity::DATA_TYPE_FLOAT0],
                
    Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING$title], Entity::DATA_BOUNDING_BOX_WIDTH => [Entity::DATA_TYPE_FLOAT0], Entity::DATA_BOUNDING_BOX_HEIGHT => [Entity::DATA_TYPE_FLOAT0]];
            foreach(
    $players as $player){
                
    $pk = clone $packet;
                
    $pk->$player->x;
                
    $pk->$player->28;
                
    $pk->$player->z;
                
    $player->dataPacket($pk);
            }

            
    $bpk = new BossEventPacket(); // This updates the bar
            
    $bpk->bossEid $eid;
            
    $bpk->eventType BossEventPacket::TYPE_SHOW;
            
    $bpk->title $title;
            
    $bpk->healthPercent 100;
            
    $bpk->unknownShort 0//TODO: remove. Shoghi deleted that unneeded mess that was copy-pasted from MC-JAVA
            
    $bpk->color 0//TODO: remove. Shoghi deleted that unneeded mess that was copy-pasted from MC-JAVA
            
    $bpk->overlay 0//TODO: remove. Shoghi deleted that unneeded mess that was copy-pasted from MC-JAVA
            
    $this->getServer()->broadcastPacket($players$bpk);

            return 
    $eid// TODO: return EID from bosseventpacket?
        
    }
     
  2. moska

    moska Baby Zombie

    Messages:
    105
    GitHub:
    supermaxalex
    Don't spawn a Wither. Use AddPlayerPacket directly
     
  3. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    Yeah, i've a lot of errors too. Has the author updated the Source Code?
     
  4. EnderKenji

    EnderKenji Creeper

    Messages:
    2
    GitHub:
    EnderKenji
    Thanks Max :)
     
  5. moska

    moska Baby Zombie

    Messages:
    105
    GitHub:
    supermaxalex
    No problem Kenji :p
     
  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.