Commits
coll1234567 authored and md_5 committed 23cffd9cff6
1 1 | package org.bukkit.block; |
2 2 | |
3 - | import java.util.Collection; |
4 - | import java.util.List; |
5 - | import org.bukkit.block.spawner.SpawnRule; |
6 - | import org.bukkit.block.spawner.SpawnerEntry; |
7 - | import org.bukkit.entity.EntitySnapshot; |
8 - | import org.bukkit.entity.EntityType; |
9 - | import org.jetbrains.annotations.NotNull; |
3 + | import org.bukkit.spawner.Spawner; |
10 4 | import org.jetbrains.annotations.Nullable; |
11 5 | |
12 6 | /** |
13 7 | * Represents a captured state of a creature spawner. |
14 8 | */ |
15 - | public interface CreatureSpawner extends TileState { |
16 - | |
17 - | /** |
18 - | * Get the spawner's creature type. |
19 - | * |
20 - | * @return The creature type or null if it not set. |
21 - | */ |
22 - | |
23 - | public EntityType getSpawnedType(); |
24 - | |
25 - | /** |
26 - | * Set the spawner's creature type. <br> |
27 - | * This will override any entities that have been added with {@link #addPotentialSpawn} |
28 - | * |
29 - | * @param creatureType The creature type or null to clear. |
30 - | */ |
31 - | public void setSpawnedType( EntityType creatureType); |
9 + | public interface CreatureSpawner extends TileState, Spawner { |
32 10 | |
33 11 | /** |
34 12 | * Set the spawner mob type. |
35 13 | * |
36 14 | * @param creatureType The creature type's name or null to clear. |
37 15 | * @deprecated magic value, use |
38 16 | * {@link #setSpawnedType(org.bukkit.entity.EntityType)}. |
39 17 | */ |
40 18 | |
41 19 | public void setCreatureTypeByName( String creatureType); |
42 20 | |
43 21 | /** |
44 22 | * Get the spawner's creature type. |
45 23 | * |
46 24 | * @return The creature type's name if is set. |
47 25 | * @deprecated magic value, use {@link #getSpawnedType()}. |
48 26 | */ |
49 27 | |
50 28 | |
51 29 | public String getCreatureTypeName(); |
52 - | |
53 - | /** |
54 - | * Get the spawner's delay. |
55 - | * <br> |
56 - | * This is the delay, in ticks, until the spawner will spawn its next mob. |
57 - | * |
58 - | * @return The delay. |
59 - | */ |
60 - | public int getDelay(); |
61 - | |
62 - | /** |
63 - | * Set the spawner's delay. |
64 - | * <br> |
65 - | * If set to -1, the spawn delay will be reset to a random value between |
66 - | * {@link #getMinSpawnDelay} and {@link #getMaxSpawnDelay()}. |
67 - | * |
68 - | * @param delay The delay. |
69 - | */ |
70 - | public void setDelay(int delay); |
71 - | |
72 - | /** |
73 - | * The minimum spawn delay amount (in ticks). |
74 - | * <br> |
75 - | * This value is used when the spawner resets its delay (for any reason). |
76 - | * It will choose a random number between {@link #getMinSpawnDelay()} |
77 - | * and {@link #getMaxSpawnDelay()} for its next {@link #getDelay()}. |
78 - | * <br> |
79 - | * Default value is 200 ticks. |
80 - | * |
81 - | * @return the minimum spawn delay amount |
82 - | */ |
83 - | public int getMinSpawnDelay(); |
84 - | |
85 - | /** |
86 - | * Set the minimum spawn delay amount (in ticks). |
87 - | * |
88 - | * @param delay the minimum spawn delay amount |
89 - | * @see #getMinSpawnDelay() |
90 - | */ |
91 - | public void setMinSpawnDelay(int delay); |
92 - | |
93 - | /** |
94 - | * The maximum spawn delay amount (in ticks). |
95 - | * <br> |
96 - | * This value is used when the spawner resets its delay (for any reason). |
97 - | * It will choose a random number between {@link #getMinSpawnDelay()} |
98 - | * and {@link #getMaxSpawnDelay()} for its next {@link #getDelay()}. |
99 - | * <br> |
100 - | * This value <b>must</b> be greater than 0 and less than or equal to |
101 - | * {@link #getMaxSpawnDelay()}. |
102 - | * <br> |
103 - | * Default value is 800 ticks. |
104 - | * |
105 - | * @return the maximum spawn delay amount |
106 - | */ |
107 - | public int getMaxSpawnDelay(); |
108 - | |
109 - | /** |
110 - | * Set the maximum spawn delay amount (in ticks). |
111 - | * <br> |
112 - | * This value <b>must</b> be greater than 0, as well as greater than or |
113 - | * equal to {@link #getMinSpawnDelay()} |
114 - | * |
115 - | * @param delay the new maximum spawn delay amount |
116 - | * @see #getMaxSpawnDelay() |
117 - | */ |
118 - | public void setMaxSpawnDelay(int delay); |
119 - | |
120 - | /** |
121 - | * Get how many mobs attempt to spawn. |
122 - | * <br> |
123 - | * Default value is 4. |
124 - | * |
125 - | * @return the current spawn count |
126 - | */ |
127 - | public int getSpawnCount(); |
128 - | |
129 - | /** |
130 - | * Set how many mobs attempt to spawn. |
131 - | * |
132 - | * @param spawnCount the new spawn count |
133 - | */ |
134 - | public void setSpawnCount(int spawnCount); |
135 - | |
136 - | /** |
137 - | * Set the new maximum amount of similar entities that are allowed to be |
138 - | * within spawning range of this spawner. |
139 - | * <br> |
140 - | * If more than the maximum number of entities are within range, the spawner |
141 - | * will not spawn and try again with a new {@link #getDelay()}. |
142 - | * <br> |
143 - | * Default value is 16. |
144 - | * |
145 - | * @return the maximum number of nearby, similar, entities |
146 - | */ |
147 - | public int getMaxNearbyEntities(); |
148 - | |
149 - | /** |
150 - | * Set the maximum number of similar entities that are allowed to be within |
151 - | * spawning range of this spawner. |
152 - | * <br> |
153 - | * Similar entities are entities that are of the same {@link EntityType} |
154 - | * |
155 - | * @param maxNearbyEntities the maximum number of nearby, similar, entities |
156 - | */ |
157 - | public void setMaxNearbyEntities(int maxNearbyEntities); |
158 - | |
159 - | /** |
160 - | * Get the maximum distance(squared) a player can be in order for this |
161 - | * spawner to be active. |
162 - | * <br> |
163 - | * If this value is less than or equal to 0, this spawner is always active |
164 - | * (given that there are players online). |
165 - | * <br> |
166 - | * Default value is 16. |
167 - | * |
168 - | * @return the maximum distance(squared) a player can be in order for this |
169 - | * spawner to be active. |
170 - | */ |
171 - | public int getRequiredPlayerRange(); |
172 - | |
173 - | /** |
174 - | * Set the maximum distance (squared) a player can be in order for this |
175 - | * spawner to be active. |
176 - | * <br> |
177 - | * Setting this value to less than or equal to 0 will make this spawner |
178 - | * always active (given that there are players online). |
179 - | * |
180 - | * @param requiredPlayerRange the maximum distance (squared) a player can be |
181 - | * in order for this spawner to be active. |
182 - | */ |
183 - | public void setRequiredPlayerRange(int requiredPlayerRange); |
184 - | |
185 - | /** |
186 - | * Get the radius around which the spawner will attempt to spawn mobs in. |
187 - | * <br> |
188 - | * This area is square, includes the block the spawner is in, and is |
189 - | * centered on the spawner's x,z coordinates - not the spawner itself. |
190 - | * <br> |
191 - | * It is 2 blocks high, centered on the spawner's y-coordinate (its bottom); |
192 - | * thus allowing mobs to spawn as high as its top surface and as low |
193 - | * as 1 block below its bottom surface. |
194 - | * <br> |
195 - | * Default value is 4. |
196 - | * |
197 - | * @return the spawn range |
198 - | */ |
199 - | public int getSpawnRange(); |
200 - | |
201 - | /** |
202 - | * Set the new spawn range. |
203 - | * <br> |
204 - | * |
205 - | * @param spawnRange the new spawn range |
206 - | * @see #getSpawnRange() |
207 - | */ |
208 - | public void setSpawnRange(int spawnRange); |
209 - | |
210 - | /** |
211 - | * Gets the {@link EntitySnapshot} that will be spawned by this spawner or null |
212 - | * if no entities have been assigned to this spawner. <br> |
213 - | * <p> |
214 - | * All applicable data from the spawner will be copied, such as custom name, |
215 - | * health, and velocity. <br> |
216 - | * |
217 - | * @return the entity snapshot or null if no entities have been assigned to this |
218 - | * spawner. |
219 - | */ |
220 - | |
221 - | public EntitySnapshot getSpawnedEntity(); |
222 - | |
223 - | /** |
224 - | * Sets the entity that will be spawned by this spawner. <br> |
225 - | * This will override any previous entries that have been added with |
226 - | * {@link #addPotentialSpawn} |
227 - | * <p> |
228 - | * All applicable data from the snapshot will be copied, such as custom name, |
229 - | * health, and velocity. <br> |
230 - | * |
231 - | * @param snapshot the entity snapshot |
232 - | */ |
233 - | public void setSpawnedEntity( EntitySnapshot snapshot); |
234 - | |
235 - | /** |
236 - | * Adds a new {@link EntitySnapshot} to the list of entities this spawner can |
237 - | * spawn. |
238 - | * <p> |
239 - | * The weight will determine how often this entry is chosen to spawn, higher |
240 - | * weighted entries will spawn more often than lower weighted ones. <br> |
241 - | * The {@link SpawnRule} will determine under what conditions this entry can |
242 - | * spawn, passing null will use the default conditions for the given entity. |
243 - | * |
244 - | * @param snapshot the snapshot that will be spawned |
245 - | * @param weight the weight |
246 - | * @param spawnRule the spawn rule for this entity, or null |
247 - | */ |
248 - | public void addPotentialSpawn( EntitySnapshot snapshot, int weight, SpawnRule spawnRule); |
249 - | |
250 - | /** |
251 - | * Adds a new {@link SpawnerEntry} to the list of entities this spawner can |
252 - | * spawn. <br> |
253 - | * |
254 - | * @param spawnerEntry the spawner entry to use |
255 - | * @see #addPotentialSpawn(EntitySnapshot, int, SpawnRule) |
256 - | */ |
257 - | public void addPotentialSpawn( final SpawnerEntry spawnerEntry); |
258 - | |
259 - | /** |
260 - | * Sets the list of {@link SpawnerEntry} this spawner can spawn. <br> |
261 - | * This will override any previous entries added with |
262 - | * {@link #addPotentialSpawn} |
263 - | * |
264 - | * @param entries the list of entries |
265 - | */ |
266 - | public void setPotentialSpawns( final Collection<SpawnerEntry> entries); |
267 - | |
268 - | /** |
269 - | * Gets a list of potential spawns from this spawner or an empty list if no |
270 - | * entities have been assigned to this spawner. <br> |
271 - | * Changes made to the returned list will not be reflected in the spawner unless |
272 - | * applied with {@link #setPotentialSpawns} |
273 - | * |
274 - | * @return a list of potential spawns from this spawner, or an empty list if no |
275 - | * entities have been assigned to this spawner |
276 - | * @see #getSpawnedType() |
277 - | */ |
278 - | |
279 - | public List<SpawnerEntry> getPotentialSpawns(); |
280 30 | } |