1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Anybody walk through to help me complete the wings particles plugin

Discussion in 'Development' started by Ngao, Jun 1, 2017.

  1. Ngao

    Ngao Silverfish

    Messages:
    18
    PHP:
    <?php

    /*
     *
     * __  __ _                               
     *|  \/  (_)              /\             
     *| \  / |_ _ __   ___   /  \   _ __ ___ 
     *| |\/| | | '_ \ / _ \ / /\ \ | '__/ _ \
     *| |  | | | | | |  __// ____ \| | | (_) |
     *|_|  |_|_|_| |_|\___/_/    \_\_|  \___/                     
     *
     *
     *
    */

    namespace Wing;

    use 
    pocketmine\event\Listener;

    use 
    pocketmine\plugin\PluginBase;

    use 
    pocketmine\event\player\PlayerChatEvent;
    use 
    pocketmine\event\player\PlayerMoveEvent;
    use 
    pocketmine\event\player\PlayerQuitEvent;
    use 
    pocketmine\event\player\PlayerKickEvent;
    use 
    pocketmine\event\player\PlayerDeathEvent;
    use 
    pocketmine\event\player\PlayerInteractEvent;
    use 
    pocketmine\event\player\PlayerDropItemEvent;
    use 
    pocketmine\event\block\BlockBreakEvent;


    use 
    pocketmine\event\entity\EntityDamageEvent;
    use 
    pocketmine\event\entity\ProjectileLaunchEvent;
    use 
    pocketmine\event\entity\ProjectileHitEvent;
    use 
    pocketmine\event\entity\EntityDamageByEntityEvent;
    use 
    pocketmine\event\block\SignChangeEvent;

    use 
    pocketmine\level\Position;
    use 
    pocketmine\level\particle\FlameParticle;
    use 
    pocketmine\utils\Config;
    use 
    pocketmine\item\Item;
    use 
    pocketmine\block\Block;

    use 
    pocketmine\entity\Arrow;
    use 
    pocketmine\entity\Entity;


    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;


    use 
    pocketmine\nbt\tag\IntTag;
    use 
    pocketmine\nbt\tag\CompoundTag;

    use 
    pocketmine\math\Vector2;
    use 
    pocketmine\math\Vector3;

    use 
    pocketmine\Player;
    use 
    pocketmine\IPlayer;



    class 
    Main extends PluginBase implements Listener {

        private 
    $db;
        public 
    $player "";

        public function 
    player(Player $player)
        {
            return 
    $player;
        }

        public function 
    onCommand(CommandSender $senderCommand $command$label, array $args)
        {
            
    $player $this->player($sender);
            
    $map = [];
            
    $lines explode("\n"rtrim("X       X
     XX   XX
      XXXXX
        X"
    ));

            
    $height count($lines);
            foreach(
    $lines as $lineNumber => $line){
                
    $len strlen($line);
                for(
    $i 0$i $len; ++$i){
                    if(
    $line{$i} === "X"){
                        
    $map[] = new Vector2($i$height $lineNumber 1);
                    }
                }
            }
            
    $scale 0.2;
            
    $particle = new FlameParticle(new Vector3);
            
    $yaw $player->yaw 180 M_PI;
            
    $xFactor = -sin($yaw) * $scale;
            
    $zFactor cos($yaw) * $scale;
            foreach(
    $map as $vector){
                
    $particle->$vector->y;
                
    $particle->$xFactor $vector->x;
                
    $particle->$zFactor $vector->x;
                
    $player->getLevel()->addParticle($particle);
            }


        }

    }
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    We don't know what error you're getting.
     
    corytortoise likes this.
  3. Mespeczek

    Mespeczek Silverfish

    Messages:
    15
    GitHub:
    Igomisz123
    Where is the command you need to enter to make the code work?
     
    RyanShaw likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.