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

get particle

Comments in 'Plugin Development' started by Flabe, Jan 16, 2016.

Thread Status:
Not open for further replies.
  1. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    Hello guys , do you know how to get particle by its parameters i there something like getParticle()??
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You cannot get a particle. Particles are not tracked server-side - apart from FloatingTextParticle, the server doesn't even have a working reference to the particle to communicate to the client with.
    You can, however, do that with FloatingTextParticle, as it is actually an entity.
    wolfdale and Flabe like this.
  3. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    please help me to get Floatingtextparticle
  4. XFuryMCPE
    Offline

    XFuryMCPE Active Member Plugin Developer

    Joined:
    Jun 19, 2015
    Posts:
    137
    Plugins:
    2
    Minecraft User:
    XFuriousMC
    PHP:
    $player->getLevel()->addParticle(new FloatingTextParticle(new Vector3($player->getX(),$player->getY(),$player->getZ()), "Put text here"));
  5. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    oh no you didn't understood my question i need to get existing floatingtextparticle not set it
  6. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    One way is to store the FloatingTextParticle object in an array, then get it when ever you want
    Vaivez66 likes this.
  7. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    please give me an example
  8. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    How do you want to identity the particles? By position?
  9. Flabe
    Offline

    Flabe Active Member

    Joined:
    Nov 17, 2015
    Posts:
    147
    Minecraft User:
    Flabe231
    i want to remove all floating text particles
  10. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    A FloatingTextParticle is not a real entity, its just packets sent to players, so actually when they quit, they they wont see it anymore unless you spawn it again.

    When you spawn it
    PHP:
    $particle = new FloatingTextParticle(new Vector3($x,$y,$z),"text","title");
    $this->particles[] = $particle;
    $level->addParticle($particle);
    This will despawn them from all players
    PHP:
    foreach($this->particles as $particle) {
    $particle->setInvisible(true);
    $level->addParticle($particle,$this->getServer()->getOnlinePlayers());
    }
    Last edited: Jan 16, 2016
    Andrey Nazarchuk likes this.
  11. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I guess we would need a tutorial for storing per session data.
    Andrey Nazarchuk likes this.
Thread Status:
Not open for further replies.

Share This Page

Advertisement