Package noppes.npcs.api.entity
Interface IProjectile
-
public interface IProjectile
Represents a projectile entity. Provides methods to access and modify the projectile's item, gravity, accuracy, heading, and to enable scripting events.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
enableEvents()
Enables projectile events for the current scripting container.int
getAccuracy()
Returns the accuracy value for the projectile.boolean
getHasGravity()
IItemStack
getItem()
Returns the item associated with the projectile (e.g.IEntity
getThrower()
Returns the thrower (the entity that launched the projectile).void
setAccuracy(int accuracy)
Sets the accuracy value for the projectile.void
setHasGravity(boolean bo)
Sets whether the projectile is affected by gravity.void
setHeading(double x, double y, double z)
Sets the heading for the projectile to the specified coordinates.void
setHeading(float yaw, float pitch)
Sets the heading using yaw and pitch values.void
setHeading(IEntity entity)
Sets the heading (target destination) for the projectile based on the target entity.void
setItem(IItemStack item)
Sets the item for the projectile.
-
-
-
Method Detail
-
getItem
IItemStack getItem()
Returns the item associated with the projectile (e.g. arrow, fireball).- Returns:
- the item as an IItemStack.
-
setItem
void setItem(IItemStack item)
Sets the item for the projectile.- Parameters:
item
- the item to set.
-
getHasGravity
boolean getHasGravity()
- Returns:
- true if the projectile is affected by gravity; false if it flies straight.
-
setHasGravity
void setHasGravity(boolean bo)
Sets whether the projectile is affected by gravity.- Parameters:
bo
- true to enable gravity; false otherwise.
-
getAccuracy
int getAccuracy()
Returns the accuracy value for the projectile.- Returns:
- the accuracy.
-
setAccuracy
void setAccuracy(int accuracy)
Sets the accuracy value for the projectile.- Parameters:
accuracy
- the accuracy value.
-
setHeading
void setHeading(IEntity entity)
Sets the heading (target destination) for the projectile based on the target entity. The projectile's position should already be set.- Parameters:
entity
- the target entity.
-
setHeading
void setHeading(double x, double y, double z)
Sets the heading for the projectile to the specified coordinates. The projectile's position should already be set.- Parameters:
x
- the target x coordinate.y
- the target y coordinate.z
- the target z coordinate.
-
setHeading
void setHeading(float yaw, float pitch)
Sets the heading using yaw and pitch values.- Parameters:
yaw
- the yaw angle.pitch
- the pitch angle.
-
getThrower
IEntity getThrower()
Returns the thrower (the entity that launched the projectile).- Returns:
- the thrower as an IEntity.
-
enableEvents
void enableEvents()
Enables projectile events for the current scripting container. Must be called during a script.
-
-