Commits
Parker Hawke authored and md_5 committed 9756fccce8a
1 1 | package org.bukkit.block; |
2 2 | |
3 + | import java.util.Collection; |
4 + | import org.bukkit.entity.LivingEntity; |
5 + | import org.bukkit.util.BoundingBox; |
6 + | import org.jetbrains.annotations.NotNull; |
7 + | import org.jetbrains.annotations.Nullable; |
8 + | |
3 9 | /** |
4 10 | * Represents a captured state of a conduit. |
5 11 | */ |
6 - | public interface Conduit extends TileState { } |
12 + | public interface Conduit extends TileState { |
13 + | |
14 + | /** |
15 + | * Checks whether or not this conduit is active. |
16 + | * <p> |
17 + | * A conduit is considered active if there are at least 16 valid frame |
18 + | * blocks surrounding it and the conduit is surrounded by a 3x3x3 area of |
19 + | * water source blocks (or waterlogged blocks), at which point its animation |
20 + | * will activate, start spinning, and apply effects to nearby players. |
21 + | * |
22 + | * @return true if active, false otherwise |
23 + | */ |
24 + | public boolean isActive(); |
25 + | |
26 + | /** |
27 + | * Get whether or not this conduit is actively hunting for nearby hostile |
28 + | * creatures. |
29 + | * <p> |
30 + | * A conduit will hunt if it is active (see {@link #isActive()}) and its |
31 + | * frame is complete (it is surrounded by at least 42 valid frame blocks). |
32 + | * While hunting, the {@link #getTarget() |
33 + | * conduit's target}, if within its {@link #getHuntingArea() hunting area}, |
34 + | * will be damaged every 2 seconds. |
35 + | * |
36 + | * @return true if hunting, false otherwise |
37 + | */ |
38 + | public boolean isHunting(); |
39 + | |
40 + | /** |
41 + | * Get a {@link Collection} of all {@link Block Blocks} that make up the |
42 + | * frame of this conduit. The returned collection will contain only blocks |
43 + | * that match the types required by the conduit to make up a valid frame, |
44 + | * <strong>not</strong> the blocks at which the conduit is searching, |
45 + | * meaning it will be of variable size depending on how many valid frames |
46 + | * are surrounding the conduit at the time of invocation. |
47 + | * |
48 + | * @return the frame blocks |
49 + | */ |
50 + | |
51 + | public Collection<Block> getFrameBlocks(); |
52 + | |
53 + | /** |
54 + | * Get the amount of valid frame blocks that are currently surrounding the |
55 + | * conduit. |
56 + | * |
57 + | * @return the frame block count |
58 + | */ |
59 + | public int getFrameBlockCount(); |
60 + | |
61 + | /** |
62 + | * Get the range (measured in blocks) within which players will receive the |
63 + | * conduit's benefits. |
64 + | * |
65 + | * @return the conduit range |
66 + | */ |
67 + | public int getRange(); |
68 + | |
69 + | /** |
70 + | * Set the conduit's hunting target. |
71 + | * <p> |
72 + | * Note that the value set by this method may be overwritten by the |
73 + | * conduit's periodic hunting logic. If the target is ever set to |
74 + | * {@code null}, the conduit will continue to look for a new target. |
75 + | * Additionally, if the target is set to an entity that does not meet a |
76 + | * conduit's hunting conditions (e.g. the entity is not within the |
77 + | * {@link #getHuntingArea() hunting area}, has already been killed, etc.) |
78 + | * then the passed entity will be ignored and the conduit will also continue |
79 + | * to look for a new target. |
80 + | * |
81 + | * @param target the target entity, or null to remove the target |
82 + | * |
83 + | * @return true if the target was changed, false if the target was the same |
84 + | */ |
85 + | public boolean setTarget( LivingEntity target); |
86 + | |
87 + | /** |
88 + | * Get the conduit's hunting target. |
89 + | * |
90 + | * @return the hunting target, or null if the conduit does not have a target |
91 + | */ |
92 + | |
93 + | public LivingEntity getTarget(); |
94 + | |
95 + | /** |
96 + | * Check whether or not this conduit has an active (alive) hunting target. |
97 + | * |
98 + | * @return true if has a hunting target, false otherwise |
99 + | */ |
100 + | public boolean hasTarget(); |
101 + | |
102 + | /** |
103 + | * Get a {@link BoundingBox} (relative to real-world coordinates) in which |
104 + | * the conduit will search for hostile entities to target. |
105 + | * |
106 + | * @return the hunting area bounding box |
107 + | */ |
108 + | |
109 + | public BoundingBox getHuntingArea(); |
110 + | } |