42 $location = $player->getLocation();
46 return ItemUseResult::FAIL;
51 $item->applyDamage(1);
53 $entity =
new TridentEntity(Location::fromObject(
56 ($location->yaw > 180 ? 360 : 0) - $location->yaw,
60 $baseForce = min((($p ** 2) + $p * 2) / 3, 1) * 2.4;
61 $entity->setMotion($player->getDirectionVector()->multiply($baseForce));
63 $ev =
new ProjectileLaunchEvent($entity);
65 if($ev->isCancelled()){
66 $ev->getEntity()->flagForDespawn();
67 return ItemUseResult::FAIL;
69 $ev->getEntity()->spawnToAll();
70 $location->getWorld()->addSound($location,
new TridentThrowSound());
72 return ItemUseResult::SUCCESS;