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.block.Block;
5
6import java.util.HashSet;
7import java.util.List;
8
9/**
10 * Represents a living entity, such as a monster or player
11 */
12public interface LivingEntity extends Entity {
13
14 /**
15 * Gets the entity's health from 0-20, where 0 is dead and 20 is full
16 *
17 * @return Health represented from 0-20
18 */
19 public int getHealth();
20
21 /**
22 * Sets the entity's health from 0-20, where 0 is dead and 20 is full
23 *
24 * @param health New health represented from 0-20
25 */
26 public void setHealth(int health);
27
28 /**
29 * Gets the height of the entity's head above its Location
30 *
31 * @return Height of the entity's eyes above its Location
32 */
33 public double getEyeHeight();
34
35 /**
36 * Gets the height of the entity's head above its Location
37 *
38 * @param boolean If set to true, the effects of sneaking will be ignored
39 * @return Height of the entity's eyes above its Location
40 */
41 public double getEyeHeight(boolean ignoreSneaking);
42
43 /**
44 * Get a Location detailing the current eye position of the LivingEntity.
45 *
46 * @return a Location at the eyes of the LivingEntity.
47 */
48 public Location getEyeLocation();
49
50 /**
51 * Gets all blocks along the player's line of sight
52 * List iterates from player's position to target inclusive
53 *
54 * @param HashSet<Byte> HashSet containing all transparent block IDs. If set to null only air is considered transparent.
55 * @param int This is the maximum distance to scan. This may be further limited by the server, but never to less than 100 blocks.
56 * @return List containing all blocks along the player's line of sight
57 */
58 public List<Block> getLineOfSight(HashSet<Byte> transparent, int maxDistance);
59
60 /**
61 * Gets the block that the player has targeted
62 *
63 * @param HashSet<Byte> HashSet containing all transparent block IDs. If set to null only air is considered transparent.
64 * @param int This is the maximum distance to scan. This may be further limited by the server, but never to less than 100 blocks.
65 * @return Block that the player has targeted
66 */
67 public Block getTargetBlock(HashSet<Byte> transparent, int maxDistance);
68
69 /**
70 * Gets the last two blocks along the player's line of sight.
71 * The target block will be the last block in the list.
72 *
73 * @param HashSet<Byte> HashSet containing all transparent block IDs. If set to null only air is considered transparent.
74 * @param int This is the maximum distance to scan. This may be further limited by the server, but never to less than 100 blocks
75 * @return List containing the last 2 blocks along the player's line of sight
76 */
77 public List<Block> getLastTwoTargetBlocks(HashSet<Byte> transparent, int maxDistance);
78
79 /**
80 * Throws an egg from the entity.
81 */
82 public Egg throwEgg();
83
84 /**
85 * Throws a snowball from the entity.
86 */
87 public Snowball throwSnowball();
88
89 /**
90 * Shoots an arrow from the entity.
91 *
92 * @return
93 */
94 public Arrow shootArrow();
95
96 /**
97 * Returns whether this entity is inside a vehicle.
98 *
99 * @return
100 */
101 public boolean isInsideVehicle();
102
103 /**
104 * Leave the current vehicle. If the entity is currently in a vehicle
105 * (and is removed from it), true will be returned, otherwise false will
106 * be returned.
107 *
108 * @return
109 */
110 public boolean leaveVehicle();
111
112 /**
113 * Get the vehicle that this player is inside. If there is no vehicle,
114 * null will be returned.
115 *
116 * @return
117 */
118 public Vehicle getVehicle();
119
120 /**
121 * Returns the amount of air that this entity has remaining, in ticks
122 *
123 * @return Amount of air remaining
124 */
125 public int getRemainingAir();
126
127 /**
128 * Sets the amount of air that this entity has remaining, in ticks
129 *
130 * @param ticks Amount of air remaining
131 */
132 public void setRemainingAir(int ticks);
133
134 /**
135 * Returns the maximum amount of air this entity can have, in ticks
136 *
137 * @return Maximum amount of air
138 */
139 public int getMaximumAir();
140
141 /**
142 * Sets the maximum amount of air this entity can have, in ticks
143 *
144 * @param ticks Maximum amount of air
145 */
146 public void setMaximumAir(int ticks);
147
148 /**
149 * Deals the given amount of damage to this entity
150 *
151 * @param amount Amount of damage to deal
152 */
153 public void damage(int amount);
154
155 /**
156 * Deals the given amount of damage to this entity, from a specified entity
157 *
158 * @param amount Amount of damage to deal
159 * @param source Entity which to attribute this damage from
160 */
161 public void damage(int amount, Entity source);
162
163 /**
164 * Returns the entities current maximum noDamageTicks
165 * This is the time in ticks the entity will become unable to take
166 * equal or less damage than the lastDamage
167 *
168 * @return noDamageTicks
169 */
170 public int getMaximumNoDamageTicks();
171
172 /**
173 * Sets the entities current maximum noDamageTicks
174 *
175 * @param ticks maximumNoDamageTicks
176 */
177 public void setMaximumNoDamageTicks(int ticks);
178
179 /**
180 * Returns the entities lastDamage taken in the current noDamageTicks time.
181 * Only damage higher than this amount will further damage the entity.
182 *
183 * @return lastDamage
184 */
185 public int getLastDamage();
186
187 /**
188 * Sets the entities current maximum noDamageTicks
189 *
190 * @param damage last damage
191 */
192 public void setLastDamage(int damage);
193
194 /**
195 * Returns the entities current noDamageTicks
196 *
197 * @return noDamageTicks
198 */
199 public int getNoDamageTicks();
200
201 /**
202 * Sets the entities current noDamageTicks
203 *
204 * @param ticks NoDamageTicks
205 */
206 public void setNoDamageTicks(int ticks);
207
208}