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
A fake projectile that plays particles along its path
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double
static final String
static final String
Settings key for the drag rate the projectile is subjected tostatic final String
Settings key for the gravity the projectile is subjected toprotected Supplier
<org.bukkit.entity.LivingEntity> static final String
static final String
static final String
static final String
Deprecated.unintuitively named, now PERIOD is used insteadprotected Consumer
<org.bukkit.Location> static final String
Settings key for the projectile's period for playing particlesstatic final String
static final String
static final String
Settings key for the projectile speedstatic final String
Settings key for the minimum projectile steps per meterstatic final String
Fields inherited from class studio.magemonkey.fabled.api.projectile.CustomProjectile
ally, callback, enemy, settings
-
Constructor Summary
ConstructorsConstructorDescriptionParticleProjectile
(org.bukkit.entity.LivingEntity shooter, int level, org.bukkit.Location loc, Settings settings, int lifespan, int distance) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected org.bukkit.event.Event
expire()
Handles expiring due to range or leaving loaded chunksprotected double
org.bukkit.Location
Retrieves the location of the projectileorg.bukkit.Location
org.bukkit.util.Vector
protected org.bukkit.event.Event
hit
(org.bukkit.entity.LivingEntity entity) Handles hitting an entityprotected org.bukkit.event.Event
land()
Handles landing on terrainprotected boolean
landed()
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.void
run()
Updates the projectiles position and checks for collisionsvoid
Passes the current projectile's location to the consumer every step of the wayvoid
setVelocity
(org.bukkit.util.Vector vel) Sets the velocity of the projectilestatic 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.void
teleport
(org.bukkit.Location loc) Teleports the projectile to a locationMethods inherited from class studio.magemonkey.fabled.api.projectile.CustomProjectile
applyLanded, calcRain, calcSpread, cancel, checkCollision, getMetadata, getShooter, hasMetadata, isTraveling, isValid, removeMetadata, setAllyEnemy, setCallback, setMetadata
Methods inherited from class org.bukkit.scheduler.BukkitRunnable
getTaskId, isCancelled, runTask, runTaskAsynchronously, runTaskLater, runTaskLaterAsynchronously, runTaskTimer, runTaskTimerAsynchronously
-
Field Details
-
SPEED
Settings key for the projectile speed- See Also:
-
STEPS
Settings key for the minimum projectile steps per meter- See Also:
-
GRAVITY
Settings key for the gravity the projectile is subjected to- See Also:
-
DRAG
Settings key for the drag rate the projectile is subjected to- See Also:
-
PERIOD
Settings key for the projectile's period for playing particles- See Also:
-
HOMING
- See Also:
-
HOMING_TARGET
- See Also:
-
HOMING_DIST
- See Also:
-
REMEMBER
- See Also:
-
CORRECTION
- See Also:
-
WALL
- See Also:
-
RADIUS
- See Also:
-
LEGACY_FREQUENCY
Deprecated.unintuitively named, now PERIOD is used insteadSettings key for the projectile's frequency of playing particles- See Also:
-
onStep
-
homing
-
correction
protected double correction
-
-
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 projectilelevel
- level to use for scaling the speedloc
- initial location of the projectilesettings
- settings for the projectile
-
-
Method Details
-
getLocation
public org.bukkit.Location getLocation()Retrieves the location of the projectile- Specified by:
getLocation
in interfaceFollowable
- Specified by:
getLocation
in classCustomProjectile
- 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 classCustomProjectile
-
land
protected org.bukkit.event.Event land()Handles landing on terrain- Specified by:
land
in classCustomProjectile
-
hit
protected org.bukkit.event.Event hit(org.bukkit.entity.LivingEntity entity) Handles hitting an entity- Specified by:
hit
in classCustomProjectile
- Parameters:
entity
- entity the projectile hit
-
landed
protected boolean landed()- Specified by:
landed
in classCustomProjectile
- Returns:
- true if passing through a solid block, false otherwise
-
getCollisionRadius
protected double getCollisionRadius()- Specified by:
getCollisionRadius
in classCustomProjectile
- Returns:
- squared radius for colliding
-
getVelocity
public org.bukkit.util.Vector getVelocity()- Specified by:
getVelocity
in classCustomProjectile
- 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 classCustomProjectile
- Parameters:
vel
- new velocity
-
setOnStep
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 projectileslevel
- level to use for scaling the speeddirection
- the center direction of the spreadloc
- location to shoot fromsettings
- settings to use when firingangle
- angle of the spreadamount
- number of projectiles to firecallback
- optional callback for when projectiles hitlifespan
- lifespan of the projectiledistance
- 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 projectileslevel
- level to use for scaling the speedcenter
- the center location to rain onsettings
- settings to use when firingradius
- radius of the circleheight
- height above the center locationamount
- number of projectiles to firecallback
- optional callback for when projectiles hitlifespan
- lifespan of the projectiledistance
- distance the projectile can travel- Returns:
- list of fired projectiles
-