Files
Paper/paper-api/src/main/java/org/bukkit/entity/Entity.java
2011-04-02 01:07:41 -04:00

148 lines
3.4 KiB
Java

package org.bukkit.entity;
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.util.Vector;
/**
* Represents a base entity in the world
*/
public interface Entity {
/**
* Gets the entity's current position
*
* @return Location containing the position of this entity
*/
public Location getLocation();
/**
* 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();
/**
* 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 <code>true</code> if the teleport was successful
*/
public boolean teleport(Location location);
/**
* Teleports this entity to the target Entity
*
* @param destination Entity to teleport this entity to
* @return <code>true</code> if the teleport was successful
*/
public boolean teleport(Entity destination);
/**
* Teleports this entity to the given location
*
* @param location New location to teleport this entity to
* @deprecated use {@link #teleport(Location)}
*/
public void teleportTo(Location location);
/**
* Teleports this entity to the target Entity
*
* @param destination Entity to teleport this entity to
* @deprecated use {@link #teleport(Entity)}
*/
public void teleportTo(Entity destination);
/**
* Returns a unique id for this entity
*
* @return Entity id
*/
public int getEntityId();
/**
* Returns the entity's current fire ticks (ticks before the entity stops being on fire).
*
* @return int fireTicks
*/
public int getFireTicks();
/**
* Returns the entity's maximum fire ticks.
*
* @return int maxFireTicks
*/
public int getMaxFireTicks();
/**
* Sets the entity's current fire ticks (ticks before the entity stops being on fire).
*
* @param ticks
*/
public void setFireTicks(int ticks);
/**
* Mark the entity's removal.
*/
public void remove();
/**
* Returns true if this entity has been marked for removal.
*/
public boolean isDead();
/**
* Gets the {@link Server} that contains this Entity
*
* @return Server instance running this Entity
*/
public Server getServer();
/**
* Gets the primary passenger of a vehicle. For vehicles that could have
* multiple passengers, this will only return the primary passenger.
*
* @return an entity
*/
public abstract Entity getPassenger();
/**
* Set the passenger of a vehicle.
*
* @param passenger
* @return false if it could not be done for whatever reason
*/
public abstract boolean setPassenger(Entity passenger);
/**
* Returns true if the vehicle has no passengers.
*
* @return
*/
public abstract boolean isEmpty();
/**
* Eject any passenger. True if there was a passenger.
*
* @return
*/
public abstract boolean eject();
}