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

How To Use FloatingTextParticle

Comments in 'Plugin Development' started by tigerza118, May 16, 2015.

  1. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    Why I do $level->addParticle(new FloatingTextParticle(new Vector3($x, $y, $z), "Text")); and nothing happens?
  2. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    major reason: because you are doing it wrong.
    CraftYourBukkit and PEMapModder like this.
  3. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    Then I need to start? I do not understand.
  4. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    PHP:
    $x $sender->getX();
    $y $sender->getY() + 2;
    $z $sender->getY();
    $level $sender->getLevel();
    $level->addParticle(new FloatingTextParticle(new Vector3($x$y$z), "Text"));
    Make sure to use everything.
  5. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    Correct?
    PHP:
        public function onJoin(PlayerJoinEvent $event){   
            
    $x $sender->getX();
            
    $y $sender->getY() + 2;
            
    $z $sender->getY();
            
    $level $sender->getLevel();
            
    $level->addParticle(new FloatingTextParticle(new Vector3($x$y$z), "Text"));
        }
  6. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Yes but it doesn't really make sense to spawn a FloatingTextParticle in the Player on Join
  7. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    no, its not.

    it must be $event->getPlayer() instead of $sender.
  8. Mel_Starty
    Offline

    Mel_Starty New Member

    Joined:
    May 6, 2015
    Posts:
    5
    Minecraft User:
    Mel_Starty

    PHP:
    public function onJoin(PlayerJoinEvent $event){
            
    $sender $event->getPlayer();
            
    $x $sender->getX();
            
    $y $sender->getY() + 2;
            
    $z $sender->getY();
            
    $level $sender->getLevel();
            
    $level->addParticle(new FloatingTextParticle(new Vector3($x$y$z), "Text"));
        }
    iJoshuaHD likes this.
  9. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    now this is what you called correct :p
  10. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    I'm running but nothing happened @iJoshuaHD
  11. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    Did you import/use everything?
    iJoshuaHD likes this.
  12. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    can you please show your whole code? you might havent added the ff:
    use pocketmine\level\particle\FloatingTextParticle;
    use pocketmine\math\Vector3;
  13. Mel_Starty
    Offline

    Mel_Starty New Member

    Joined:
    May 6, 2015
    Posts:
    5
    Minecraft User:
    Mel_Starty
    PHP:
    use pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\level\particle\FloatingTextParticle;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\plugin\PluginBase;

    class 
    Main extends PluginBase implements Listener{

        public function 
    onJoin(PlayerJoinEvent $event){
            
    $sender $event->getPlayer();
            
    $x $sender->getX();
            
    $y $sender->getY() + 2;
            
    $z $sender->getY();
            
    $level $sender->getLevel();
            
    $level->addParticle(new FloatingTextParticle(new Vector3($x$y$z), "Texdwdwdwdwdawdawdaddadwadafsfsfdfet"));
        }

    }
    this code
  14. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    PHP:
    public function onEnable(){
    $this->getServer()->getPluginManager()->registerEvents($this$this);
    }
    Is missing
    PEMapModder likes this.
  15. Mel_Starty
    Offline

    Mel_Starty New Member

    Joined:
    May 6, 2015
    Posts:
    5
    Minecraft User:
    Mel_Starty
  16. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    You're welcome:)
  17. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
  18. SM11
    Offline

    SM11 Active Member

    Joined:
    Jun 21, 2015
    Posts:
    117
    Minecraft User:
    SM11
    How do I MAke it so that when someone taps the floating text particle a command is activated
  19. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Particles are not clickable.

Share This Page

Advertisement