43 $location = $player->getLocation();
47 return ItemUseResult::FAIL;
52 $item->applyDamage(self::DAMAGE_ON_THROW);
57 return ItemUseResult::FAIL;
59 $entity =
new TridentEntity(Location::fromObject(
62 ($location->yaw > 180 ? 360 : 0) - $location->yaw,
66 $baseForce = min((($p ** 2) + $p * 2) / 3, 1) * 2.4;
67 $entity->setMotion($player->getDirectionVector()->multiply($baseForce));
69 $ev =
new ProjectileLaunchEvent($entity);
71 if($ev->isCancelled()){
72 $ev->getEntity()->flagForDespawn();
73 return ItemUseResult::FAIL;
75 $ev->getEntity()->spawnToAll();
76 $location->getWorld()->addSound($location,
new TridentThrowSound());
78 return ItemUseResult::SUCCESS;