Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
Entity.java
1 package org.bukkit.entity;
2 
3 import org.bukkit.Location;
4 import org.bukkit.EntityEffect;
5 import org.bukkit.Server;
6 import org.bukkit.World;
9 import org.bukkit.util.Vector;
10 
11 import java.util.List;
12 import java.util.UUID;
14 
15 /**
16  * Represents a base entity in the world
17  */
18 public interface Entity extends Metadatable {
19 
20  /**
21  * Gets the entity's current position
22  *
23  * @return a new copy of Location containing the position of this entity
24  */
25  public Location getLocation();
26 
27  /**
28  * Stores the entity's current position in the provided Location object.
29  * <p>
30  * If the provided Location is null this method does nothing and returns
31  * null.
32  *
33  * @return The Location object provided or null
34  */
35  public Location getLocation(Location loc);
36 
37  /**
38  * Sets this entity's velocity
39  *
40  * @param velocity New velocity to travel with
41  */
42  public void setVelocity(Vector velocity);
43 
44  /**
45  * Gets this entity's current velocity
46  *
47  * @return Current travelling velocity of this entity
48  */
49  public Vector getVelocity();
50 
51  /**
52  * Returns true if the entity is supported by a block. This value is a
53  * state updated by the server and is not recalculated unless the entity
54  * moves.
55  *
56  * @return True if entity is on ground.
57  */
58  public boolean isOnGround();
59 
60  /**
61  * Gets the current world this entity resides in
62  *
63  * @return World
64  */
65  public World getWorld();
66 
67  /**
68  * Teleports this entity to the given location
69  *
70  * @param location New location to teleport this entity to
71  * @return <code>true</code> if the teleport was successful
72  */
73  public boolean teleport(Location location);
74 
75  /**
76  * Teleports this entity to the given location
77  *
78  * @param location New location to teleport this entity to
79  * @param cause The cause of this teleportation
80  * @return <code>true</code> if the teleport was successful
81  */
82  public boolean teleport(Location location, TeleportCause cause);
83 
84  /**
85  * Teleports this entity to the target Entity
86  *
87  * @param destination Entity to teleport this entity to
88  * @return <code>true</code> if the teleport was successful
89  */
90  public boolean teleport(Entity destination);
91 
92  /**
93  * Teleports this entity to the target Entity
94  *
95  * @param destination Entity to teleport this entity to
96  * @param cause The cause of this teleportation
97  * @return <code>true</code> if the teleport was successful
98  */
99  public boolean teleport(Entity destination, TeleportCause cause);
100 
101  /**
102  * Returns a list of entities within a bounding box centered around this
103  * entity
104  *
105  * @param x 1/2 the size of the box along x axis
106  * @param y 1/2 the size of the box along y axis
107  * @param z 1/2 the size of the box along z axis
108  * @return List<Entity> List of entities nearby
109  */
110  public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z);
111 
112  /**
113  * Returns a unique id for this entity
114  *
115  * @return Entity id
116  */
117  public int getEntityId();
118 
119  /**
120  * Returns the entity's current fire ticks (ticks before the entity stops
121  * being on fire).
122  *
123  * @return int fireTicks
124  */
125  public int getFireTicks();
126 
127  /**
128  * Returns the entity's maximum fire ticks.
129  *
130  * @return int maxFireTicks
131  */
132  public int getMaxFireTicks();
133 
134  /**
135  * Sets the entity's current fire ticks (ticks before the entity stops
136  * being on fire).
137  *
138  * @param ticks Current ticks remaining
139  */
140  public void setFireTicks(int ticks);
141 
142  /**
143  * Mark the entity's removal.
144  */
145  public void remove();
146 
147  /**
148  * Returns true if this entity has been marked for removal.
149  *
150  * @return True if it is dead.
151  */
152  public boolean isDead();
153 
154  /**
155  * Returns false if the entity has died or been despawned for some other
156  * reason.
157  *
158  * @return True if valid.
159  */
160  public boolean isValid();
161 
162  /**
163  * Gets the {@link Server} that contains this Entity
164  *
165  * @return Server instance running this Entity
166  */
167  public Server getServer();
168 
169  /**
170  * Gets the primary passenger of a vehicle. For vehicles that could have
171  * multiple passengers, this will only return the primary passenger.
172  *
173  * @return an entity
174  */
175  public abstract Entity getPassenger();
176 
177  /**
178  * Set the passenger of a vehicle.
179  *
180  * @param passenger The new passenger.
181  * @return false if it could not be done for whatever reason
182  */
183  public abstract boolean setPassenger(Entity passenger);
184 
185  /**
186  * Check if a vehicle has passengers.
187  *
188  * @return True if the vehicle has no passengers.
189  */
190  public abstract boolean isEmpty();
191 
192  /**
193  * Eject any passenger.
194  *
195  * @return True if there was a passenger.
196  */
197  public abstract boolean eject();
198 
199  /**
200  * Returns the distance this entity has fallen
201  *
202  * @return The distance.
203  */
204  public float getFallDistance();
205 
206  /**
207  * Sets the fall distance for this entity
208  *
209  * @param distance The new distance.
210  */
211  public void setFallDistance(float distance);
212 
213  /**
214  * Record the last {@link EntityDamageEvent} inflicted on this entity
215  *
216  * @param event a {@link EntityDamageEvent}
217  */
218  public void setLastDamageCause(EntityDamageEvent event);
219 
220  /**
221  * Retrieve the last {@link EntityDamageEvent} inflicted on this entity.
222  * This event may have been cancelled.
223  *
224  * @return the last known {@link EntityDamageEvent} or null if hitherto
225  * unharmed
226  */
228 
229  /**
230  * Returns a unique and persistent id for this entity
231  *
232  * @return unique id
233  */
234  public UUID getUniqueId();
235 
236  /**
237  * Gets the amount of ticks this entity has lived for.
238  * <p>
239  * This is the equivalent to "age" in entities.
240  *
241  * @return Age of entity
242  */
243  public int getTicksLived();
244 
245  /**
246  * Sets the amount of ticks this entity has lived for.
247  * <p>
248  * This is the equivalent to "age" in entities. May not be less than one
249  * tick.
250  *
251  * @param value Age of entity
252  */
253  public void setTicksLived(int value);
254 
255  /**
256  * Performs the specified {@link EntityEffect} for this entity.
257  * <p>
258  * This will be viewable to all players near the entity.
259  *
260  * @param type Effect to play.
261  */
262  public void playEffect(EntityEffect type);
263 
264  /**
265  * Get the type of the entity.
266  *
267  * @return The entity type.
268  */
269  public EntityType getType();
270 
271  /**
272  * Returns whether this entity is inside a vehicle.
273  *
274  * @return True if the entity is in a vehicle.
275  */
276  public boolean isInsideVehicle();
277 
278  /**
279  * Leave the current vehicle. If the entity is currently in a vehicle (and
280  * is removed from it), true will be returned, otherwise false will be
281  * returned.
282  *
283  * @return True if the entity was in a vehicle.
284  */
285  public boolean leaveVehicle();
286 
287  /**
288  * Get the vehicle that this player is inside. If there is no vehicle,
289  * null will be returned.
290  *
291  * @return The current vehicle.
292  */
293  public Entity getVehicle();
294 }
boolean teleport(Location location)
void setLastDamageCause(EntityDamageEvent event)
abstract boolean isEmpty()
EntityDamageEvent getLastDamageCause()
abstract boolean eject()
void playEffect(EntityEffect type)
void setVelocity(Vector velocity)
abstract boolean setPassenger(Entity passenger)
void setFireTicks(int ticks)
void setTicksLived(int value)
List< org.bukkit.entity.Entity > getNearbyEntities(double x, double y, double z)
abstract Entity getPassenger()
void setFallDistance(float distance)