public interface Entity extends Metadatable, CommandSender
Modifier and Type | Method and Description |
---|---|
boolean |
eject()
Eject any passenger.
|
String |
getCustomName()
Gets the custom name on a mob.
|
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.
|
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 |
isCustomNameVisible()
Gets whether or not the mob's custom name is displayed client side.
|
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 |
setCustomName(String name)
Sets a custom name on a mob.
|
void |
setCustomNameVisible(boolean flag)
Sets whether or not to display the mob's custom name client side.
|
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.
|
getMetadata, hasMetadata, removeMetadata, setMetadata
getName, sendMessage, sendMessage
addAttachment, addAttachment, addAttachment, addAttachment, getEffectivePermissions, hasPermission, hasPermission, isPermissionSet, isPermissionSet, recalculatePermissions, removeAttachment
isOp, setOp
Location getLocation()
Location getLocation(Location loc)
If the provided Location is null this method does nothing and returns null.
loc
- the location to copy intovoid setVelocity(Vector velocity)
velocity
- New velocity to travel withVector getVelocity()
boolean isOnGround()
World getWorld()
boolean teleport(Location location)
location
- New location to teleport this entity totrue
if the teleport was successfulboolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause)
location
- New location to teleport this entity tocause
- The cause of this teleportationtrue
if the teleport was successfulboolean teleport(Entity destination)
destination
- Entity to teleport this entity totrue
if the teleport was successfulboolean teleport(Entity destination, PlayerTeleportEvent.TeleportCause cause)
destination
- Entity to teleport this entity tocause
- The cause of this teleportationtrue
if the teleport was successfulList<Entity> getNearbyEntities(double x, double y, double z)
x
- 1/2 the size of the box along x axisy
- 1/2 the size of the box along y axisz
- 1/2 the size of the box along z axisList<Entity>
List of entities nearbyint getEntityId()
int getFireTicks()
int getMaxFireTicks()
void setFireTicks(int ticks)
ticks
- Current ticks remainingvoid remove()
boolean isDead()
boolean isValid()
Server getServer()
Server
that contains this EntitygetServer
in interface CommandSender
Entity getPassenger()
boolean setPassenger(Entity passenger)
passenger
- The new passenger.boolean isEmpty()
boolean eject()
float getFallDistance()
void setFallDistance(float distance)
distance
- The new distance.void setLastDamageCause(EntityDamageEvent event)
EntityDamageEvent
inflicted on this entityevent
- a EntityDamageEvent
EntityDamageEvent getLastDamageCause()
EntityDamageEvent
inflicted on this entity.
This event may have been cancelled.EntityDamageEvent
or null if hitherto
unharmedUUID getUniqueId()
int getTicksLived()
This is the equivalent to "age" in entities.
void setTicksLived(int value)
This is the equivalent to "age" in entities. May not be less than one tick.
value
- Age of entityvoid playEffect(EntityEffect type)
EntityEffect
for this entity.
This will be viewable to all players near the entity.
type
- Effect to play.EntityType getType()
boolean isInsideVehicle()
boolean leaveVehicle()
Entity getVehicle()
void setCustomName(String name)
Setting the name to null or an empty string will clear it.
This value has no effect on players, they will always use their real name.
name
- the name to setString getCustomName()
This value has no effect on players, they will always use their real name.
void setCustomNameVisible(boolean flag)
This value has no effect on players, they will always display their name.
flag
- custom name or notboolean isCustomNameVisible()
This value has no effect on players, they will always display their name.
Copyright © 2015. All rights reserved.