package org.bukkit.entity; import org.bukkit.Location; import org.bukkit.EntityEffect; import org.bukkit.Server; import org.bukkit.World; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.metadata.Metadatable; import org.bukkit.util.Vector; import java.util.List; import java.util.UUID; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; /** * Represents a base entity in the world */ public interface Entity extends Metadatable { /** * Gets the entity's current position * * @return a new copy of Location containing the position of this entity */ public Location getLocation(); /** * Stores the entity's current position in the provided Location object. *
* If the provided Location is null this method does nothing and returns
* null.
*
* @return The Location object provided or null
*/
public Location getLocation(Location loc);
/**
* Sets this entity's velocity
*
* @param velocity New velocity to travel with
*/
public void setVelocity(Vector velocity);
/**
* Gets this entity's current velocity
*
* @return Current travelling velocity of this entity
*/
public Vector getVelocity();
/**
* 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.
*
* @return True if entity is on ground.
*/
public boolean isOnGround();
/**
* Gets the current world this entity resides in
*
* @return World
*/
public World getWorld();
/**
* Teleports this entity to the given location
*
* @param location New location to teleport this entity to
* @return
* This is the equivalent to "age" in entities.
*
* @return Age of entity
*/
public int getTicksLived();
/**
* 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.
*
* @param value Age of entity
*/
public void setTicksLived(int value);
/**
* Performs the specified {@link EntityEffect} for this entity.
*
* This will be viewable to all players near the entity.
*
* @param type Effect to play.
*/
public void playEffect(EntityEffect type);
/**
* Get the type of the entity.
*
* @return The entity type.
*/
public EntityType getType();
/**
* Returns whether this entity is inside a vehicle.
*
* @return True if the entity is in a vehicle.
*/
public boolean isInsideVehicle();
/**
* 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.
*
* @return True if the entity was in a vehicle.
*/
public boolean leaveVehicle();
/**
* Get the vehicle that this player is inside. If there is no vehicle,
* null will be returned.
*
* @return The current vehicle.
*/
public Entity getVehicle();
}
true if the teleport was successful
*/
public boolean teleport(Location location);
/**
* Teleports this entity to the given location
*
* @param location New location to teleport this entity to
* @param cause The cause of this teleportation
* @return true if the teleport was successful
*/
public boolean teleport(Location location, TeleportCause cause);
/**
* Teleports this entity to the target Entity
*
* @param destination Entity to teleport this entity to
* @return true if the teleport was successful
*/
public boolean teleport(Entity destination);
/**
* Teleports this entity to the target Entity
*
* @param destination Entity to teleport this entity to
* @param cause The cause of this teleportation
* @return true if the teleport was successful
*/
public boolean teleport(Entity destination, TeleportCause cause);
/**
* Returns a list of entities within a bounding box centered around this
* entity
*
* @param x 1/2 the size of the box along x axis
* @param y 1/2 the size of the box along y axis
* @param z 1/2 the size of the box along z axis
* @return List