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

particles in the air

Comments in 'Plugin Development' started by TryoneLegendZzz, Sep 27, 2015.

  1. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Yes. It's possible. I already said so in an earlier post.
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    You just repeated the same thing… -_-
  3. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    this i what i mean the little particles Screenshot_2015-09-27-20-39-42.png
  4. lucasvitegui
    Offline

    lucasvitegui Active Member

    Joined:
    Apr 18, 2015
    Posts:
    191
    Minecraft User:
    lucasviteguiBR
    Awesome your Parkour plugin
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    This is the easy way. Using repeating task is the hard way. And this "easy" way doesn't work, because it will block the main thread. It seems like it is you who don't know what loops are. Loops are something that is run consistently until the loop finished. Before the loop is finished, nothing else on the same thread (in this case the main thread) runs.
    Andrey Nazarchuk and Legoboy0215 like this.
  6. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    I never specified which thread it should run on. You know what... never mind.
  7. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Yes, just spawn a particle with the coordinates you want it to float.
    PHP:
    $this->getServer()->getLevelByName($levelName)->addParticle(new $particle(new Position($x$y$z$level));
  8. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    Code:
    getLevelByName($levelName)->addParticle(new $particle(in the air));
    Taha_The_Hacker likes this.
  9. CaptainKenji17
    Offline

    CaptainKenji17 Active Member

    Joined:
    Apr 22, 2014
    Posts:
    252
    Minecraft User:
    CaptainKenji17
    well maybe I can help you by idea?
    I can't code but i think some of people there could understand this

    how about you do pos1/pos2 like world edit and inside of it //set {particle} ? instead of //set {block}?
  10. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    ahhh nvm i have done it thanks :D
  11. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Why use Positon? Vector3 is already good enough(in this situation).
    Last edited: Sep 29, 2015
    Legoboy0215 likes this.
  12. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    PHP:
    $this->getServer()->getLevelByName($levelName)->addParticle(new $particle(new Vector3($x$y$z$level));
    rand pos ? *-*
  13. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    You want the particles to be spawned at random places? If so, use mt_rand().
    Last edited: Sep 29, 2015
  14. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Use mt_rand(min, max);
  15. MCPEPIG
    Offline

    MCPEPIG Notable Member

    Joined:
    Jun 22, 2014
    Posts:
    349
    Minecraft User:
    MCPEPIG
    ... in the air = Not a Vector3 or Position
  16. tigerza118
    Offline

    tigerza118 Active Member

    Joined:
    Jan 31, 2015
    Posts:
    100
    Minecraft User:
    tigerza117
    upload_2015-9-29_8-21-27.png

    PHP:
    <?php

    namespace tiger\air;

    use 
    pocketmine\scheduler\PluginTask;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\level\particle\ExplodeParticle;
    use 
    pocketmine\level\particle\HeartParticle;
    use 
    pocketmine\level\particle\CriticalParticle;
    use 
    pocketmine\level\particle\DustParticle;
    use 
    pocketmine\level\particle;
    use 
    pocketmine\math\Vector3;

    class 
    ChangeBlockTask extends PluginTask{

        public function 
    onRun($currentTick){
            
    $x mt_rand(140115);
            
    $y mt_rand(2135);
            
    $z mt_rand(115140);
            foreach (
    $this->owner->getServer()->getLevels() as $lv) {
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            
    $lv->addParticle(new DustParticle(new Vector3($x$y$z), 255255255));
            }
        }
    }
  17. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Please learn how to read properly. The smaller value comes first, not the larger one. It says in the console error. http://php.net/manual/en/function.mt-rand.php
    Taha_The_Hacker likes this.
  18. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    You don't even need to know PHP to read the error message :)
    MAX is SMALLER than MIN.
    Taha_The_Hacker likes this.
  19. Hotshot_9930
    Offline

    Hotshot_9930 Notable Member Plugin Developer

    Joined:
    May 26, 2014
    Posts:
    665
    Plugins:
    2
    Minecraft User:
    HotshotHD
    Why did u make the first number bigger?
    this is the correct way:
    PHP:
    $x mt_rand(115140);
    And btw you should read the console errors more thoroughly. It clearly states this problem.
  20. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Then tell him, because right now he doesn't even know how to read the error. :)

Share This Page

Advertisement