Guys,I saw many issues about particles don't work and owner (dktapps) said that its client side bug, but I see that on other events or tasks, particles work fine. Anyway, I tried to use three particles like AngryVillagerParticle (more examples on my codes) but when I walk on the world I want, I don't see any particle and I have passed all the checks I added like if I have permission or not. Can someone help and tell me what is wrong in my codes?I have registered the Particles Event and I have tried many things to make them work but no luck.
PHP: <?phpnamespace gofightcore\cosmeticsthings;use pocketmine\event\Listener;use pocketmine\event\player\PlayerMoveEvent;use pocketmine\math\Vector3;use pocketmine\level\particle\AngryVillagerParticle;use pocketmine\level\particle\DustParticle;use gofightcore\tasks\RainbowParticlesTask;use pocketmine\level\particle\FloatingTextParticle;use gofightcore\Main;Class Particles implements Listener { /** @var Main */ private $plugin; public function __construct(Main $plugin) { $this->plugin = $plugin; } public function onPlayerMove(PlayerMoveEvent $ev){ /**if($ev->getPlayer()->hasPermission("particles.walk.rainbow") == true){ if($ev->getPlayer()->getLevel()->getName() == "GoSpawn"){$from = $ev->getFrom();$to = $ev->getTo();//$speed = $from->distance($to);$speed = abs($ev->getPlayer()->getMotion()->x) + abs($ev->getPlayer()->getMotion()->z);//$speed = $ev->getPlayer()->getMotion(); if($speed->x > 0){ $rainbowparticlestask = new RainbowParticlesTask($this->plugin, $ev->getPlayer()); $rainbowparticleshandler = $this->plugin->getScheduler()->scheduleRepeatingTask($rainbowparticlestask, 5); } else { } } }*/ if($ev->getPlayer()->hasPermission("particles.walk.floatingtext") == true){ if($ev->getPlayer()->getLevel()->getName() === "hypixel1"){$from = $ev->getFrom();$to = $ev->getTo();/**$speed = $from->distance($to);$speed = abs($ev->getPlayer()->getMotion()->x) + abs($ev->getPlayer()->getMotion()->z);*/$speed = $ev->getPlayer()->getMotion(); if($speed->x > 0){$x = $ev->getPlayer()->getX();$y = $ev->getPlayer()->getY();$z = $ev->getPlayer()->getZ();$red = new FloatingTextParticle(new Vector3($x, $y + 2.5), "§c+");$orange = new FloatingTextParticle(new Vector3($x, $y + 2.1), "§6+");$yellow = new FloatingTextParticle(new Vector3($x, $y + 1.7), "§e+");$green = new FloatingTextParticle(new Vector3($x, $y + 1.3), "§a+");$lblue = new FloatingTextParticle(new Vector3($x, $y + 0.9), "§b+");$dblue = new FloatingTextParticle(new Vector3($x, $y + 0.5), "§1+");foreach ([$red, $orange, $yellow, $green, $lblue, $dblue] as $particle) { $ev->getPlayer()->getLevel()->addParticle($particle); } } else { } } } if($ev->getPlayer()->hasPermission("particles.walk.angryvillager") == true){ if($ev->getPlayer()->getLevel()->getName() === "hypixel1"){$from = $ev->getFrom();$to = $ev->getTo();/**$speed = $from->distance($to);$speed = abs($ev->getPlayer()->getMotion()->x) + abs($ev->getPlayer()->getMotion()->z);*/$speed = $ev->getPlayer()->getMotion(); if($speed->x > 0){$x = $ev->getPlayer()->getX();$y = $ev->getPlayer()->getY();$z = $ev->getPlayer()->getZ();$particle = new AngryVillagerParticle(new Vector3($x, $y + 2.5)); $ev->getPlayer()->getLevel()->addParticle($particle); } else { } } } } //end }
Ok but even if I use the $speed = $from->distance($to); as $speed, particles won't work and there aren't any errors on my codes.
In your code PHP: $particle = new AngryVillagerParticle(new Vector3($x, $y + 2.5)); you are missing the z of the Vector3 PHP: $particle = new AngryVillagerParticle(new Vector3($x, $y + 2.5,$z));