-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathShape.java
256 lines (186 loc) · 6.78 KB
/
Shape.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
package hm.zelha.particlesfx.shapers.parents;
import hm.zelha.particlesfx.particles.parents.Particle;
import hm.zelha.particlesfx.util.Rotation;
import hm.zelha.particlesfx.util.ShapeDisplayMechanic;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import java.util.List;
import java.util.UUID;
public interface Shape {
/**
* @return this object
*/
Shape start();
/**
* @return this object
*/
Shape stop();
void display();
Shape clone();
void rotate(double pitch, double yaw, double roll);
void rotateAroundLocation(Location around, double pitch, double yaw, double roll);
void face(Location toFace);
void faceAroundLocation(Location toFace, Location around);
/**
* adds the given x, y, z values to every location in the shape
*
* @param x x addition
* @param y y addition
* @param z z addition
*/
void move(double x, double y, double z);
/**
* adds the given vector to every location in the shape
*
* @param vector vector to add
*/
void move(Vector vector);
/**
* adds the given location to every location in the shape
*
* @param location location to add
*/
void move(Location location);
/**
* Rescales this shape such that a shape with the xyz radiuses of 4, 3, 4, resized by 1.25, 1.25, 1.25, would have its
* radiuses become 5, 3.75, 5.
*
* @param x x scale
* @param y y scale
* @param z z scale
*/
void scale(double x, double y, double z);
/**
* Rescales this shape such that a shape with the xyz radiuses of 4, 3, 4, resized by 1.25, would have its
* radiuses become 5, 3.75, 5.
*
* @param scale scale amount
*/
void scale(double scale);
/**
* Similar to {@link java.util.function.Consumer} <br>
* in the case of phases {@link ShapeDisplayMechanic.Phase#BEFORE_ROTATION} and {@link ShapeDisplayMechanic.Phase#AFTER_ROTATION}
* the given mechanic will run before the location is modified to display the next particle, allowing you to modify the
* addition vector however you want, though doing so may be very volatile
* <br><br>
* keep in mind that all changes to the given objects will be reflected in the display() method, and considering that
* the display() method often displays hundreds of particles, try to make sure the mechanic isn't very
* resource-intensive
* <br><br>
* {@link ShapeDisplayMechanic#apply(Particle, Location, Vector, int)}
*
* @param phase phase that the mechanic should run at
* @param mechanic mechanic to run during display
*/
void addMechanic(ShapeDisplayMechanic.Phase phase, ShapeDisplayMechanic mechanic);
/**
* adds a player for this shape to display to, defaults to all online players in the shape's world if the list is empty
*
* @param player player to add
*/
void addPlayer(Player player);
/**
* adds a player for this shape to display to, defaults to all online players in the shape's world if the list is empty
*
* @param uuid ID of player to add
*/
void addPlayer(UUID uuid);
/**
* @see Shape#addMechanic(ShapeDisplayMechanic.Phase, ShapeDisplayMechanic)
* @param index index of mechanic in list
*/
void removeMechanic(int index);
/**
* @see Shape#addPlayer(Player)
* @param index index of player to remove from list
*/
void removePlayer(int index);
/**
* @see Shape#addPlayer(Player)
* @param player player to remove from list
*/
void removePlayer(Player player);
void setParticle(Particle particle);
/** @param particleFrequency amount of times to display the particle per full animation */
void setParticleFrequency(int particleFrequency);
/**
* 0 means that the entire animation will be played when .display() is called
*
* @param particlesPerDisplay amount of particles that will be shown per display
* @return
*/
Shape setParticlesPerDisplay(int particlesPerDisplay);
/**
* @param delay amount of ticks between {@link Shape#display()} being called
* @return
*/
Shape setDelay(int delay);
/**
* sets the current position of the shape's animation <br>
* (aka, sets the tracker that tells the shape how many particles have been displayed until this point) <br>
*
* @param position position for shape to display at
*/
void setDisplayPosition(int position);
void setWorld(World world);
void setRotation(double pitch, double yaw, double roll);
void setRotationOrder(Rotation.Axis first, Rotation.Axis second, Rotation.Axis third);
void setPitch(double pitch);
void setYaw(double yaw);
void setRoll(double roll);
void setAroundRotation(Location around, double pitch, double yaw, double roll);
void setAroundRotationOrder(Location around, Rotation.Axis first, Rotation.Axis second, Rotation.Axis third);
void setAroundPitch(Location around, double pitch);
void setAroundYaw(Location around, double yaw);
void setAroundRoll(Location around, double roll);
void setAxisRotation(double pitch, double yaw, double roll);
void setAxisPitch(double pitch);
void setAxisYaw(double yaw);
void setAxisRoll(double roll);
void setAroundAxisRotation(Location around, double pitch, double yaw, double roll);
void setAroundAxisPitch(Location around, double pitch);
void setAroundAxisYaw(Location around, double yaw);
void setAroundAxisRoll(Location around, double roll);
World getWorld();
Particle getParticle();
int getParticleFrequency();
/**
* @see Shape#setParticlesPerDisplay(int)
* @return the amount of particles per display
*/
int getParticlesPerDisplay();
/**
* @return the UUIDs of all the players that this shape displays to. displays to all players if this list is empty
*/
List<UUID> getPlayers();
/**
* @return amount of players this shape displays to
*/
int getPlayerAmount();
Rotation.Axis[] getRotationOrder();
double getPitch();
double getYaw();
double getRoll();
Rotation.Axis[] getAroundRotationOrder();
double getAroundPitch();
double getAroundYaw();
double getAroundRoll();
double getAxisPitch();
double getAxisYaw();
double getAxisRoll();
double getAroundAxisPitch();
double getAroundAxisYaw();
double getAroundAxisRoll();
Location[] getLocations();
int getLocationAmount();
/**
* @return the distance between every location in this shape
*/
double getTotalDistance();
/**
* @return a new Location object set to the center of this shape
*/
Location getClonedCenter();
}