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

FloatingTextParticle Bug

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
    Screenshot_2015-05-16-18-01-14.jpg FloatingTextParticle Bug
  2. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Use color codes correctly.
  3. Mel_Starty
    Offline

    Mel_Starty New Member

    Joined:
    May 6, 2015
    Posts:
    5
    Minecraft User:
    Mel_Starty
    how to fix this
  4. Mel_Starty
    Offline

    Mel_Starty New Member

    Joined:
    May 6, 2015
    Posts:
    5
    Minecraft User:
    Mel_Starty
    should use TextFormat or SS -..-
  5. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    I am User Color code §
  6. hoyinm14mc
    Offline

    hoyinm14mc Notable Member Plugin Developer

    Joined:
    Jun 4, 2014
    Posts:
    501
    Plugins:
    9
    Minecraft User:
    hoyinm14mc
    Try to use TextFormat
    PEMapModder likes this.
  7. Sergey_D
    Offline

    Sergey_D Active Member

    Joined:
    Jan 19, 2014
    Posts:
    75
    Minecraft User:
    CLILLZ
    \pocketmine\utils\TextFormat::WHAT_NEED
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
  9. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    PHP:
    namespace spocket\mel;

    use 
    pocketmine\event\Listener;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\level\particle\FloatingTextParticle;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\utils\TextFormat;

    class 
    Main extends PluginBase implements Listener{

        public function 
    onEnable(){
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
        }
        public function 
    onJoin(PlayerJoinEvent $event ){
            
    $sender $event->getPlayer();
            
    $level $sender->getLevel();
            
    $pos = new Vector3(12743128);
            
    #$pos1 = new Vector3(127, 44, 133);   
            #$pos2 = new Vector3(122, 44, 128);   
            #$pos3 = new Vector3(132, 44, 128);       
            #$pos4 = new Vector3(127, 44, 123);           
            
    $level->addParticle(new FloatingTextParticle($pos->add(0.50.00.5), "§cS§6P§eO§aC§bK§9E§dT §espk.ddns.net §d19132"));
            
    #$level->addParticle(new FloatingTextParticle($pos1->add(0.5, 0.0, 0.5), "SURVIVAL SERVER"));
            #$level->addParticle(new FloatingTextParticle($pos2->add(0.5, 0.0, 0.5), "MINIGAME SERVER"));       
            #$level->addParticle(new FloatingTextParticle($pos3->add(0.5, 0.0, 0.5), "SPOCKET SERVER"));   
            #$level->addParticle(new FloatingTextParticle($pos4->add(0.5, 0.0, 0.5), "?????"));       
        
    }

    }
  10. GamesLoad
    Offline

    GamesLoad Active Member

    Joined:
    Jun 28, 2014
    Posts:
    106
    Minecraft User:
    GamesLoad
    use
    $level->addParticle(new FloatingTextParticle($pos->add(0.5, 0.0, 0.5), TextFormat::RED . "ciao"));
  11. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    I get the same, not black but with a grey line above the text and i'm using
    PHP:
    $level->addParticle(new FloatingTextParticle(new Vector3(-16912485),TextFormat::GREEN"TESTO CASUALE"));
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Use the constant references, not their values.
  13. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    It happens too
  14. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    i fixed by adding "", like here
    PHP:
    $level->addParticle(new FloatingTextParticle($coords),""TextFormat::RED ...
    i think it is not the right solution but it works
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It is wrong.
    https://github.com/PocketMine/PocketMine-MP/blob/master/src/pocketmine/level/Level.php#L452
    The second parameter for addParticle should be an array or nothing.
    https://github.com/PocketMine/Pocke...e/level/particle/FloatingTextParticle.php#L37
    The text should be inside the constructor of FloatingTextParticle, so the ) is too early.
  16. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
  17. hoyinm14mc
    Offline

    hoyinm14mc Notable Member Plugin Developer

    Joined:
    Jun 4, 2014
    Posts:
    501
    Plugins:
    9
    Minecraft User:
    hoyinm14mc
    Try to add it by a command and player's location, set the words in-game. It works fine for me, no line above.
    Example:
    PHP:
    //Command to type: /addfloatingtext &4Hi &a&lWelcome to &2Cyber&6Cube&5-&cHK&f!!
    $sender->getLevel()->addParticle(new FloatingTextParticle(new Vector3($sender->x$sender->y$sender->z), str_replace("&""§"$this->getMsg($args))); 
    After that, you will see a floating text at the pos you issue the command, 'Hi Welcome to CyberCube-HK!!' with colours.
    See EvolSoft's Broadcaster plugin to see how getMsg() works. ($args is an array with each arguments you type into the command, you have to implode them)
    Last edited: May 20, 2015
  18. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Or just try "\n"
  19. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    MY SERVER
    Screenshot_2015-05-18-19-29-17.jpg
    Fcmcpe server
    Screenshot_2015-05-20-20-13-05.jpg
    What is full code no bug no lag
  20. Jon
    Offline

    Jon Active Member Plugin Developer

    Joined:
    Sep 1, 2013
    Posts:
    201
    Plugins:
    3
    Minecraft User:
    Heromine14
    Doesn't work

Share This Page

Advertisement