org.bukkit.entity
Interface Entity

All Superinterfaces:
Metadatable
All Known Subinterfaces:
Ageable, Ambient, Animals, Arrow, Bat, Blaze, Boat, CaveSpider, Chicken, ComplexEntityPart, ComplexLivingEntity, Cow, Creature, Creeper, Damageable, Egg, EnderCrystal, EnderDragon, EnderDragonPart, Enderman, EnderPearl, EnderSignal, ExperienceOrb, Explosive, ExplosiveMinecart, FallingBlock, FallingSand, Fireball, Firework, Fish, Flying, Ghast, Giant, Golem, Hanging, HopperMinecart, Horse, HumanEntity, IronGolem, Item, ItemFrame, LargeFireball, LeashHitch, LightningStrike, LivingEntity, MagmaCube, Minecart, Monster, MushroomCow, NPC, Ocelot, Painting, Pig, PigZombie, Player, PoweredMinecart, PoweredMinecart, Projectile, RideableMinecart, Sheep, Silverfish, Skeleton, Slime, SmallFireball, Snowball, Snowman, SpawnerMinecart, Spider, Squid, StorageMinecart, StorageMinecart, ThrownExpBottle, ThrownPotion, TNTPrimed, Vehicle, Villager, WaterMob, Weather, Witch, Wither, WitherSkull, Wolf, Zombie

public interface Entity
extends Metadatable

Represents a base entity in the world


Method Summary
 boolean eject()
          Eject any passenger.
 int getEntityId()
          Returns a unique id for this entity
 float getFallDistance()
          Returns the distance this entity has fallen
 int getFireTicks()
          Returns the entity's current fire ticks (ticks before the entity stops being on fire).
 EntityDamageEvent getLastDamageCause()
          Retrieve the last EntityDamageEvent inflicted on this entity.
 Location getLocation()
          Gets the entity's current position
 Location getLocation(Location loc)
          Stores the entity's current position in the provided Location object.
If the provided Location is null this method does nothing and returns null.
 int getMaxFireTicks()
          Returns the entity's maximum fire ticks.
 List<Entity> getNearbyEntities(double x, double y, double z)
          Returns a list of entities within a bounding box centered around this entity
 Entity getPassenger()
          Gets the primary passenger of a vehicle.
 Server getServer()
          Gets the Server that contains this Entity
 int getTicksLived()
          Gets the amount of ticks this entity has lived for.
 EntityType getType()
          Get the type of the entity.
 UUID getUniqueId()
          Returns a unique and persistent id for this entity
 Entity getVehicle()
          Get the vehicle that this player is inside.
 Vector getVelocity()
          Gets this entity's current velocity
 World getWorld()
          Gets the current world this entity resides in
 boolean isDead()
          Returns true if this entity has been marked for removal.
 boolean isEmpty()
          Check if a vehicle has passengers.
 boolean isInsideVehicle()
          Returns whether this entity is inside a vehicle.
 boolean isOnGround()
          Returns true if the entity is supported by a block.
 boolean isValid()
          Returns false if the entity has died or been despawned for some other reason.
 boolean leaveVehicle()
          Leave the current vehicle.
 void playEffect(EntityEffect type)
          Performs the specified EntityEffect for this entity.
 void remove()
          Mark the entity's removal.
 void setFallDistance(float distance)
          Sets the fall distance for this entity
 void setFireTicks(int ticks)
          Sets the entity's current fire ticks (ticks before the entity stops being on fire).
 void setLastDamageCause(EntityDamageEvent event)
          Record the last EntityDamageEvent inflicted on this entity
 boolean setPassenger(Entity passenger)
          Set the passenger of a vehicle.
 void setTicksLived(int value)
          Sets the amount of ticks this entity has lived for.
 void setVelocity(Vector velocity)
          Sets this entity's velocity
 boolean teleport(Entity destination)
          Teleports this entity to the target Entity
 boolean teleport(Entity destination, PlayerTeleportEvent.TeleportCause cause)
          Teleports this entity to the target Entity
 boolean teleport(Location location)
          Teleports this entity to the given location
 boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause)
          Teleports this entity to the given location
 
Methods inherited from interface org.bukkit.metadata.Metadatable
getMetadata, hasMetadata, removeMetadata, setMetadata
 

Method Detail

getLocation

Location getLocation()
Gets the entity's current position

Returns:
a new copy of Location containing the position of this entity

getLocation

Location getLocation(Location loc)
Stores the entity's current position in the provided Location object.
If the provided Location is null this method does nothing and returns null.

Returns:
The Location object provided or null

setVelocity

void setVelocity(Vector velocity)
Sets this entity's velocity

Parameters:
velocity - New velocity to travel with

getVelocity

Vector getVelocity()
Gets this entity's current velocity

Returns:
Current travelling velocity of this entity

isOnGround

boolean isOnGround()
Returns true if the entity is supported by a block. This value is a state updated by the server and is not recalculated unless the entity moves.

Returns:
True if entity is on ground.

getWorld

World getWorld()
Gets the current world this entity resides in

Returns:
World

teleport

boolean teleport(Location location)
Teleports this entity to the given location

Parameters:
location - New location to teleport this entity to
Returns:
true if the teleport was successful

teleport

boolean teleport(Location location,
                 PlayerTeleportEvent.TeleportCause cause)
Teleports this entity to the given location

Parameters:
location - New location to teleport this entity to
cause - The cause of this teleportation
Returns:
true if the teleport was successful

teleport

boolean teleport(Entity destination)
Teleports this entity to the target Entity

Parameters:
destination - Entity to teleport this entity to
Returns:
true if the teleport was successful

teleport

boolean teleport(Entity destination,
                 PlayerTeleportEvent.TeleportCause cause)
Teleports this entity to the target Entity

Parameters:
destination - Entity to teleport this entity to
cause - The cause of this teleportation
Returns:
true if the teleport was successful

getNearbyEntities

List<Entity> getNearbyEntities(double x,
                               double y,
                               double z)
Returns a list of entities within a bounding box centered around this entity

Parameters:
x - 1/2 the size of the box along x axis
y - 1/2 the size of the box along y axis
z - 1/2 the size of the box along z axis
Returns:
List List of entities nearby

getEntityId

int getEntityId()
Returns a unique id for this entity

Returns:
Entity id

getFireTicks

int getFireTicks()
Returns the entity's current fire ticks (ticks before the entity stops being on fire).

Returns:
int fireTicks

getMaxFireTicks

int getMaxFireTicks()
Returns the entity's maximum fire ticks.

Returns:
int maxFireTicks

setFireTicks

void setFireTicks(int ticks)
Sets the entity's current fire ticks (ticks before the entity stops being on fire).

Parameters:
ticks - Current ticks remaining

remove

void remove()
Mark the entity's removal.


isDead

boolean isDead()
Returns true if this entity has been marked for removal.

Returns:
True if it is dead.

isValid

boolean isValid()
Returns false if the entity has died or been despawned for some other reason.

Returns:
True if valid.

getServer

Server getServer()
Gets the Server that contains this Entity

Returns:
Server instance running this Entity

getPassenger

Entity getPassenger()
Gets the primary passenger of a vehicle. For vehicles that could have multiple passengers, this will only return the primary passenger.

Returns:
an entity

setPassenger

boolean setPassenger(Entity passenger)
Set the passenger of a vehicle.

Parameters:
passenger - The new passenger.
Returns:
false if it could not be done for whatever reason

isEmpty

boolean isEmpty()
Check if a vehicle has passengers.

Returns:
True if the vehicle has no passengers.

eject

boolean eject()
Eject any passenger.

Returns:
True if there was a passenger.

getFallDistance

float getFallDistance()
Returns the distance this entity has fallen

Returns:
The distance.

setFallDistance

void setFallDistance(float distance)
Sets the fall distance for this entity

Parameters:
distance - The new distance.

setLastDamageCause

void setLastDamageCause(EntityDamageEvent event)
Record the last EntityDamageEvent inflicted on this entity

Parameters:
event - a EntityDamageEvent

getLastDamageCause

EntityDamageEvent getLastDamageCause()
Retrieve the last EntityDamageEvent inflicted on this entity. This event may have been cancelled.

Returns:
the last known EntityDamageEvent or null if hitherto unharmed

getUniqueId

UUID getUniqueId()
Returns a unique and persistent id for this entity

Returns:
unique id

getTicksLived

int getTicksLived()
Gets the amount of ticks this entity has lived for.

This is the equivalent to "age" in entities.

Returns:
Age of entity

setTicksLived

void setTicksLived(int value)
Sets the amount of ticks this entity has lived for.

This is the equivalent to "age" in entities. May not be less than one tick.

Parameters:
value - Age of entity

playEffect

void playEffect(EntityEffect type)
Performs the specified EntityEffect for this entity.

This will be viewable to all players near the entity.

Parameters:
type - Effect to play.

getType

EntityType getType()
Get the type of the entity.

Returns:
The entity type.

isInsideVehicle

boolean isInsideVehicle()
Returns whether this entity is inside a vehicle.

Returns:
True if the entity is in a vehicle.

leaveVehicle

boolean leaveVehicle()
Leave the current vehicle. If the entity is currently in a vehicle (and is removed from it), true will be returned, otherwise false will be returned.

Returns:
True if the entity was in a vehicle.

getVehicle

Entity getVehicle()
Get the vehicle that this player is inside. If there is no vehicle, null will be returned.

Returns:
The current vehicle.


Copyright © 2013. All Rights Reserved.