Class ParticleProjectile

java.lang.Object
org.bukkit.scheduler.BukkitRunnable
studio.magemonkey.fabled.api.projectile.CustomProjectile
studio.magemonkey.fabled.api.projectile.ParticleProjectile
All Implemented Interfaces:
Runnable, org.bukkit.metadata.Metadatable, Followable

public class ParticleProjectile extends CustomProjectile
A fake projectile that plays particles along its path
  • Field Details

  • Constructor Details

    • ParticleProjectile

      public ParticleProjectile(org.bukkit.entity.LivingEntity shooter, int level, org.bukkit.Location loc, Settings settings, int lifespan, int distance)
      Constructor
      Parameters:
      shooter - entity that shot the projectile
      level - level to use for scaling the speed
      loc - initial location of the projectile
      settings - settings for the projectile
  • Method Details

    • getLocation

      public org.bukkit.Location getLocation()
      Retrieves the location of the projectile
      Specified by:
      getLocation in interface Followable
      Specified by:
      getLocation in class CustomProjectile
      Returns:
      location of the projectile
    • getStartLocation

      public org.bukkit.Location getStartLocation()
    • expire

      protected org.bukkit.event.Event expire()
      Handles expiring due to range or leaving loaded chunks
      Specified by:
      expire in class CustomProjectile
    • land

      protected org.bukkit.event.Event land()
      Handles landing on terrain
      Specified by:
      land in class CustomProjectile
    • hit

      protected org.bukkit.event.Event hit(org.bukkit.entity.LivingEntity entity)
      Handles hitting an entity
      Specified by:
      hit in class CustomProjectile
      Parameters:
      entity - entity the projectile hit
    • landed

      protected boolean landed()
      Specified by:
      landed in class CustomProjectile
      Returns:
      true if passing through a solid block, false otherwise
    • getCollisionRadius

      protected double getCollisionRadius()
      Specified by:
      getCollisionRadius in class CustomProjectile
      Returns:
      squared radius for colliding
    • getVelocity

      public org.bukkit.util.Vector getVelocity()
      Specified by:
      getVelocity in class CustomProjectile
      Returns:
      velocity of the projectile
    • teleport

      public void teleport(org.bukkit.Location loc)
      Teleports the projectile to a location
      Parameters:
      loc - location to teleport to
    • setVelocity

      public void setVelocity(org.bukkit.util.Vector vel)
      Sets the velocity of the projectile
      Specified by:
      setVelocity in class CustomProjectile
      Parameters:
      vel - new velocity
    • setOnStep

      public void setOnStep(Consumer<org.bukkit.Location> onStep)
      Passes the current projectile's location to the consumer every step of the way
      Parameters:
      onStep - the consumer the location is passed to
    • run

      public void run()
      Updates the projectiles position and checks for collisions
    • spread

      public static List<ParticleProjectile> spread(org.bukkit.entity.LivingEntity shooter, int level, org.bukkit.util.Vector direction, org.bukkit.Location loc, Settings settings, double angle, int amount, ProjectileCallback callback, int lifespan, int distance)
      Fires a spread of projectiles from the location.
      Parameters:
      shooter - entity shooting the projectiles
      level - level to use for scaling the speed
      direction - the center direction of the spread
      loc - location to shoot from
      settings - settings to use when firing
      angle - angle of the spread
      amount - number of projectiles to fire
      callback - optional callback for when projectiles hit
      lifespan - lifespan of the projectile
      distance - distance the projectile can travel
      Returns:
      list of fired projectiles
    • rain

      public static List<ParticleProjectile> rain(org.bukkit.entity.LivingEntity shooter, int level, org.bukkit.Location center, Settings settings, double radius, double height, int amount, ProjectileCallback callback, int lifespan, int distance)
      Fires a spread of projectiles from the location.
      Parameters:
      shooter - entity shooting the projectiles
      level - level to use for scaling the speed
      center - the center location to rain on
      settings - settings to use when firing
      radius - radius of the circle
      height - height above the center location
      amount - number of projectiles to fire
      callback - optional callback for when projectiles hit
      lifespan - lifespan of the projectile
      distance - distance the projectile can travel
      Returns:
      list of fired projectiles