Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package org.bukkit.entity;
2
3import org.bukkit.Location;
4import org.bukkit.Server;
5import org.bukkit.World;
6import org.bukkit.event.entity.EntityDamageEvent;
7import org.bukkit.util.Vector;
8
9import java.util.List;
10import java.util.UUID;
11
12/**
13 * Represents a base entity in the world
14 */
15public interface Entity {
16
17 /**
18 * Gets the entity's current position
19 *
20 * @return Location containing the position of this entity
21 */
22 public Location getLocation();
23
24 /**
25 * Sets this entity's velocity
26 *
27 * @param velocity New velocity to travel with
28 */
29 public void setVelocity(Vector velocity);
30
31 /**
32 * Gets this entity's current velocity
33 *
34 * @return Current travelling velocity of this entity
35 */
36 public Vector getVelocity();
37
38 /**
39 * Gets the current world this entity resides in
40 *
41 * @return World
42 */
43 public World getWorld();
44
45 /**
46 * Teleports this entity to the given location
47 *
48 * @param location New location to teleport this entity to
49 * @return <code>true</code> if the teleport was successful
50 */
51 public boolean teleport(Location location);
52
53 /**
54 * Teleports this entity to the target Entity
55 *
56 * @param destination Entity to teleport this entity to
57 * @return <code>true</code> if the teleport was successful
58 */
59 public boolean teleport(Entity destination);
60
61 /**
62 * Returns a list of entities within a bounding box defined by x,y,z centered around player
63 *
64 * @param x Size of the box along x axis
65 * @param y Size of the box along y axis
66 * @param z Size of the box along z axis
67 * @return List<Entity> List of entities nearby
68 */
69 public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z);
70
71 /**
72 * Returns a unique id for this entity
73 *
74 * @return Entity id
75 */
76 public int getEntityId();
77
78 /**
79 * Returns the entity's current fire ticks (ticks before the entity stops being on fire).
80 *
81 * @return int fireTicks
82 */
83 public int getFireTicks();
84
85 /**
86 * Returns the entity's maximum fire ticks.
87 *
88 * @return int maxFireTicks
89 */
90 public int getMaxFireTicks();
91
92 /**
93 * Sets the entity's current fire ticks (ticks before the entity stops being on fire).
94 *
95 * @param ticks
96 */
97 public void setFireTicks(int ticks);
98
99 /**
100 * Mark the entity's removal.
101 */
102 public void remove();
103
104 /**
105 * Returns true if this entity has been marked for removal.
106 */
107 public boolean isDead();
108
109 /**
110 * Gets the {@link Server} that contains this Entity
111 *
112 * @return Server instance running this Entity
113 */
114 public Server getServer();
115
116 /**
117 * Gets the primary passenger of a vehicle. For vehicles that could have
118 * multiple passengers, this will only return the primary passenger.
119 *
120 * @return an entity
121 */
122 public abstract Entity getPassenger();
123
124 /**
125 * Set the passenger of a vehicle.
126 *
127 * @param passenger
128 * @return false if it could not be done for whatever reason
129 */
130 public abstract boolean setPassenger(Entity passenger);
131
132 /**
133 * Returns true if the vehicle has no passengers.
134 *
135 * @return
136 */
137 public abstract boolean isEmpty();
138
139 /**
140 * Eject any passenger. True if there was a passenger.
141 *
142 * @return
143 */
144 public abstract boolean eject();
145
146 /**
147 * Returns the distance this entity has fallen
148 *
149 * @return
150 */
151 public float getFallDistance();
152
153 /**
154 * Sets the fall distance for this entity
155 *
156 * @param distance
157 */
158 public void setFallDistance(float distance);
159
160 /**
161 * Record the last {@link EntityDamageEvent} inflicted on this entity
162 *
163 * @param event a {@link EntityDamageEvent}
164 */
165 public void setLastDamageCause(EntityDamageEvent event);
166
167 /**
168 * Retrieve the last {@link EntityDamageEvent} inflicted on this entity. This event may have been cancelled.
169 *
170 * @return the last known {@link EntityDamageEvent} or null if hitherto unharmed
171 */
172 public EntityDamageEvent getLastDamageCause();
173
174 /**
175 * Returns a unique and persistent id for this entity
176 *
177 * @return unique id
178 */
179 public UUID getUniqueId();
180}