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

Solved Hologram - Specific Player Text

Comments in 'Plugin Development' started by Samueljh1H8sLag, Jan 1, 2016.

  1. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    Alright, so what I'm trying to do here is have a hologram's text specific to a player. The only solution I have come up with is having seperate FloatingTextParticles for each player and set the text to them.

    Are there any other methods as this sounds like a very memory-wasting way.

    Thanks :)
  2. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    Nevermind, all you have to do is set the text, and then do
    PHP:
    $this->level->addParticle($hologram, array($player));
    This will update the text to the specific player and keep the same to any players that it has been spawned to.
    PEMapModder and KubixQ like this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    If you may need to despawn or change text on the particle, you may need to save the particle for each player.
    Or, actually, if it is always the same for all players, create the particle once a runtime.
  4. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    Nop, I got a custom Hologram class that has a settext + setInvis function which accepts a player parameter :)
  5. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Can't this be achieved by AddEntityPacket?
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    FloatingTextParticle is a convenient implementation of AddEntityPacket.
    Legoboy0215, Samueljh1H8sLag and Falk like this.

Share This Page

Advertisement