getLocation(); $projectile = $this->createEntity(Location::fromObject($player->getEyePos(), $player->getWorld(), $location->yaw, $location->pitch), $player); $projectile->setMotion($directionVector->multiply($this->getThrowForce())); $projectileEv = new ProjectileLaunchEvent($projectile); $projectileEv->call(); if($projectileEv->isCancelled()){ $projectile->flagForDespawn(); return ItemUseResult::FAIL; } $projectile->spawnToAll(); $location->getWorld()->addSound($location, new ThrowSound()); $this->pop(); return ItemUseResult::SUCCESS; } }