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

Whats wrong?

Comments in 'Plugin Development' started by JackboyPlay, Jul 24, 2016.

  1. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Hi I've tried to add and removes an FloatingTextParticl but it doesnt work what is wrong?
    PHP:
    $o $this->getOwner();
    $level $o->getServer()->getLevelByName("world");
    if(
    $o->particle == 0){
    $part = new FloatingTextParticle(new Vector3(91011962),"""§aPlatziere eine Kiste auf\n §adem §6Diamantblock");
    $part->setInvisible();
    $part1 = new FloatingTextParticle(new Vector3(91011962),"""§ePlatziere eine Kiste auf\n §adem §6Diamantblock");
    $level->addParticle($part1);
    $o->particle 1;
    }else{
    $part1 = new FloatingTextParticle(new Vector3(91011962),"""§ePlatziere eine Kiste auf\n §adem §6Diamantblock");
    $part1->setInvisible();
    $part = new FloatingTextParticle(new Vector3(91011962),"""§aPlatziere eine Kiste auf\n §adem §6Diamantblock");
    $level->addParticle($part);
    $o->particle 0;
    }
    //Before you ask YEAH its a TASK!!!!!!!!
    Here the usefull things from the main class
    PHP:
    public $particle 0;
    public function 
    onJoin(PlayerJoinEvent $event){
    $level $this->getServer()->getLevelByName("world");
    $level->addParticle(new FloatingTextParticle(new Vector3(91011962),"""§aPlatziere eine Kiste auf\n §adem §6Diamantblock"));
    }
  2. Survingo
    Offline

    Survingo Active Member

    Joined:
    Dec 6, 2015
    Posts:
    221
    It should be
    PHP:
    $part = new FloatingTextParticle(new Vector3(91011962), "§aPlatziere eine Kiste auf\n §adem §6Diamantblock");
  3. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    No
  4. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Are you using original PM, if so, Floating Texts are broken there.
  5. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    No, I use Genisys
  6. JackboyPlay
    Offline

    JackboyPlay Active Member

    Joined:
    Apr 25, 2015
    Posts:
    507
    Minecraft User:
    JackboyPlay
    Now it works but it looks strange their are 2 textes which suffocates
    Last edited: Jul 26, 2016
  7. SOFe
    Offline

    SOFe Banned

    Joined:
    May 28, 2016
    Posts:
    386
    Minecraft User:
    Herobrine
    No. You must call setInvisible() on the same instance of FloatingTextParticle. Every time you construct a new FloatingTextParticle, the new particle will hold a new entity ID. You must use the same old FloatingTextParticle to despawn it.

    In simple words, you should have a class property that stores the FloatingTextParticle you created, before you first add that particle to the world. Then when you despawn it, you have to retrieve that one particle, and then call setInvisible() on it. Creating another particle is meaningless, even if the new particle has the exactly same parameters, because the particle is identified by its entity ID, not its nametag.
    Survingo likes this.

Share This Page

Advertisement