Commits
Parker Hawke authored and md_5 committed 9ae3f10f8fa
1 1 | package org.bukkit.entity; |
2 2 | |
3 3 | import org.bukkit.inventory.meta.FireworkMeta; |
4 4 | import org.jetbrains.annotations.NotNull; |
5 + | import org.jetbrains.annotations.Nullable; |
5 6 | |
6 7 | public interface Firework extends Projectile { |
7 8 | |
8 9 | /** |
9 10 | * Get a copy of the fireworks meta |
10 11 | * |
11 12 | * @return A copy of the current Firework meta |
12 13 | */ |
13 14 | |
14 15 | FireworkMeta getFireworkMeta(); |
15 16 | |
16 17 | /** |
17 18 | * Apply the provided meta to the fireworks |
18 19 | * |
19 20 | * @param meta The FireworkMeta to apply |
20 21 | */ |
21 22 | void setFireworkMeta( FireworkMeta meta); |
22 23 | |
24 + | /** |
25 + | * Set the {@link LivingEntity} to which this firework is attached. |
26 + | * <p> |
27 + | * When attached to an entity, the firework effect will act as normal but |
28 + | * remain positioned on the entity. If the entity {@code LivingEntity#isGliding() |
29 + | * is gliding}, then the entity will receive a boost in the direction that |
30 + | * they are looking. |
31 + | * |
32 + | * @param entity the entity to which the firework should be attached, or |
33 + | * null to remove the attached entity |
34 + | * @return true if the entity could be attached, false if the firework was |
35 + | * already detonated |
36 + | */ |
37 + | boolean setAttachedTo( LivingEntity entity); |
38 + | |
39 + | /** |
40 + | * Get the {@link LivingEntity} to which this firework is attached. |
41 + | * <p> |
42 + | * When attached to an entity, the firework effect will act as normal but |
43 + | * remain positioned on the entity. If the entity {@code LivingEntity#isGliding() |
44 + | * is gliding}, then the entity will receive a boost in the direction that |
45 + | * they are looking. |
46 + | * |
47 + | * @return the attached entity, or null if none |
48 + | */ |
49 + | |
50 + | LivingEntity getAttachedTo(); |
51 + | |
52 + | /** |
53 + | * Set the ticks that this firework has been alive. If this value exceeds |
54 + | * {@link #getMaxLife()}, the firework will detonate. |
55 + | * |
56 + | * @param ticks the ticks to set. Must be greater than or equal to 0 |
57 + | * @return true if the life was set, false if this firework has already detonated |
58 + | */ |
59 + | boolean setLife(int ticks); |
60 + | |
61 + | /** |
62 + | * Get the ticks that this firework has been alive. When this value reaches |
63 + | * {@link #getMaxLife()}, the firework will detonate. |
64 + | * |
65 + | * @return the life ticks |
66 + | */ |
67 + | int getLife(); |
68 + | |
69 + | /** |
70 + | * Set the time in ticks this firework will exist until it is detonated. |
71 + | * |
72 + | * @param ticks the ticks to set. Must be greater than 0 |
73 + | * @return true if the time was set, false if this firework has already detonated |
74 + | */ |
75 + | boolean setMaxLife(int ticks); |
76 + | |
77 + | /** |
78 + | * Get the time in ticks this firework will exist until it is detonated. |
79 + | * |
80 + | * @return the maximum life in ticks |
81 + | */ |
82 + | int getMaxLife(); |
83 + | |
23 84 | /** |
24 85 | * Cause this firework to explode at earliest opportunity, as if it has no |
25 86 | * remaining fuse. |
26 87 | */ |
27 88 | void detonate(); |
28 89 | |
90 + | /** |
91 + | * Check whether or not this firework has detonated. |
92 + | * |
93 + | * @return true if detonated, false if still in the world |
94 + | */ |
95 + | boolean isDetonated(); |
96 + | |
29 97 | /** |
30 98 | * Gets if the firework was shot at an angle (i.e. from a crossbow). |
31 99 | * |
32 100 | * A firework which was not shot at an angle will fly straight upwards. |
33 101 | * |
34 102 | * @return shot at angle status |
35 103 | */ |
36 104 | boolean isShotAtAngle(); |
37 105 | |
38 106 | /** |