Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

update FloatingTextParticle

Comments in 'Plugin Development' started by Cristalix, Apr 24, 2016.

  1. Cristalix
    Offline

    Cristalix New Member

    Joined:
    Sep 10, 2015
    Posts:
    38
    Minecraft User:
    Gistrec
    How can I update FloatingTextParticle
    (I have $onlineplayer and would like to update FloatingText, but then I spawn new FloatingText with new information -> do nothing)
  2. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    onEnable
    PHP:
    $this->getServer()->getScheduler()->scheduleRepeatingTask(new UpdateTask($this$this->eid), 10);
    $this->eid mt_rand(10000,100000);
    Main class
    PHP:
    //Item = use pocketmine\entity\Item;
    $pk = new AddEntityPacket();
    $pk->eid $this->eid;
    $pk->type Item::NETWORK_ID;
    $pk->=X;
    $pk->Y;
    $pk->Z;
    $pk->metadata = [Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE<< Entity::DATA_FLAG_INVISIBLE],
    Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING$txt], //Here the you want text
    Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE1],
    Entity::DATA_NO_AI => [Entity::DATA_TYPE_BYTE1]];
    to run,
    PHP:
    class UpdateTask extends PluginTask{
        function 
    __construct(PluginBase $owner$eid){
            
    $this->owner $owner;
            
    $this->eid $eid;
        }
        function 
    onRun($tick){
            
    $pk = new SetEntityDataPacket();
            
    $pk->did $this->eid;
            
    $pk->metadata = [Entity::DATA_FLAGS => [Entity::DATA_TYPE_BYTE<< Entity::DATA_FLAG_INVISIBLE],
    Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING$txt], //Here the you want text
    Entity::DATA_SHOW_NAMETAG => [Entity::DATA_TYPE_BYTE1],
    Entity::DATA_NO_AI => [Entity::DATA_TYPE_BYTE1]];
            
    $this->owner->getServer()->broadcastPacket($this->owner->getServer()->getOnlinePlayers(), $pk);
        }
    }
    Last edited: Apr 24, 2016
    Survingo likes this.

Share This Page

Advertisement