-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathGameEvent.java
More file actions
284 lines (218 loc) · 9.45 KB
/
GameEvent.java
File metadata and controls
284 lines (218 loc) · 9.45 KB
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
package org.bukkit;
import io.papermc.paper.registry.RegistryElement;
import java.util.Collection;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.key.KeyPattern;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Represents a generic Mojang game event.
*/
public abstract class GameEvent implements RegistryElement<GameEvent>, Keyed {
// Start generate - GameEvent
public static final GameEvent BLOCK_ACTIVATE = getEvent("block_activate");
public static final GameEvent BLOCK_ATTACH = getEvent("block_attach");
public static final GameEvent BLOCK_CHANGE = getEvent("block_change");
public static final GameEvent BLOCK_CLOSE = getEvent("block_close");
public static final GameEvent BLOCK_DEACTIVATE = getEvent("block_deactivate");
public static final GameEvent BLOCK_DESTROY = getEvent("block_destroy");
public static final GameEvent BLOCK_DETACH = getEvent("block_detach");
public static final GameEvent BLOCK_OPEN = getEvent("block_open");
public static final GameEvent BLOCK_PLACE = getEvent("block_place");
public static final GameEvent CONTAINER_CLOSE = getEvent("container_close");
public static final GameEvent CONTAINER_OPEN = getEvent("container_open");
public static final GameEvent DRINK = getEvent("drink");
public static final GameEvent EAT = getEvent("eat");
public static final GameEvent ELYTRA_GLIDE = getEvent("elytra_glide");
public static final GameEvent ENTITY_ACTION = getEvent("entity_action");
public static final GameEvent ENTITY_DAMAGE = getEvent("entity_damage");
public static final GameEvent ENTITY_DIE = getEvent("entity_die");
public static final GameEvent ENTITY_DISMOUNT = getEvent("entity_dismount");
public static final GameEvent ENTITY_INTERACT = getEvent("entity_interact");
public static final GameEvent ENTITY_MOUNT = getEvent("entity_mount");
public static final GameEvent ENTITY_PLACE = getEvent("entity_place");
public static final GameEvent EQUIP = getEvent("equip");
public static final GameEvent EXPLODE = getEvent("explode");
public static final GameEvent FLAP = getEvent("flap");
public static final GameEvent FLUID_PICKUP = getEvent("fluid_pickup");
public static final GameEvent FLUID_PLACE = getEvent("fluid_place");
public static final GameEvent HIT_GROUND = getEvent("hit_ground");
public static final GameEvent INSTRUMENT_PLAY = getEvent("instrument_play");
public static final GameEvent ITEM_INTERACT_FINISH = getEvent("item_interact_finish");
public static final GameEvent ITEM_INTERACT_START = getEvent("item_interact_start");
public static final GameEvent JUKEBOX_PLAY = getEvent("jukebox_play");
public static final GameEvent JUKEBOX_STOP_PLAY = getEvent("jukebox_stop_play");
public static final GameEvent LIGHTNING_STRIKE = getEvent("lightning_strike");
public static final GameEvent NOTE_BLOCK_PLAY = getEvent("note_block_play");
public static final GameEvent PRIME_FUSE = getEvent("prime_fuse");
public static final GameEvent PROJECTILE_LAND = getEvent("projectile_land");
public static final GameEvent PROJECTILE_SHOOT = getEvent("projectile_shoot");
public static final GameEvent RESONATE_1 = getEvent("resonate_1");
public static final GameEvent RESONATE_2 = getEvent("resonate_2");
public static final GameEvent RESONATE_3 = getEvent("resonate_3");
public static final GameEvent RESONATE_4 = getEvent("resonate_4");
public static final GameEvent RESONATE_5 = getEvent("resonate_5");
public static final GameEvent RESONATE_6 = getEvent("resonate_6");
public static final GameEvent RESONATE_7 = getEvent("resonate_7");
public static final GameEvent RESONATE_8 = getEvent("resonate_8");
public static final GameEvent RESONATE_9 = getEvent("resonate_9");
public static final GameEvent RESONATE_10 = getEvent("resonate_10");
public static final GameEvent RESONATE_11 = getEvent("resonate_11");
public static final GameEvent RESONATE_12 = getEvent("resonate_12");
public static final GameEvent RESONATE_13 = getEvent("resonate_13");
public static final GameEvent RESONATE_14 = getEvent("resonate_14");
public static final GameEvent RESONATE_15 = getEvent("resonate_15");
public static final GameEvent SCULK_SENSOR_TENDRILS_CLICKING = getEvent("sculk_sensor_tendrils_clicking");
public static final GameEvent SHEAR = getEvent("shear");
public static final GameEvent SHRIEK = getEvent("shriek");
public static final GameEvent SPLASH = getEvent("splash");
public static final GameEvent STEP = getEvent("step");
public static final GameEvent SWIM = getEvent("swim");
public static final GameEvent TELEPORT = getEvent("teleport");
public static final GameEvent UNEQUIP = getEvent("unequip");
// End generate - GameEvent
/**
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
*/
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_PRESS = BLOCK_ACTIVATE;
/**
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
*/
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_SWITCH = BLOCK_ACTIVATE;
/**
* @deprecated in favor of {@link #BLOCK_DEACTIVATE}
*/
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_UNPRESS = BLOCK_DEACTIVATE;
/**
* @deprecated in favor of {@link #BLOCK_DEACTIVATE}
*/
@Deprecated(since = "1.19")
public static final GameEvent BLOCK_UNSWITCH = BLOCK_DEACTIVATE;
/**
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
*/
@Deprecated(since = "1.20")
public static final GameEvent DISPENSE_FAIL = BLOCK_ACTIVATE;
/**
* @deprecated in favor of {@link #DRINK}
*/
@Deprecated(since = "1.19")
public static final GameEvent DRINKING_FINISH = DRINK;
/**
* @deprecated in favor of {@link #ELYTRA_GLIDE}
*/
@Deprecated(since = "1.19")
public static final GameEvent ELYTRA_FREE_FALL = ELYTRA_GLIDE;
/**
* @deprecated in favor of {@link #ENTITY_DAMAGE}
*/
@Deprecated(since = "1.19")
public static final GameEvent ENTITY_DAMAGED = ENTITY_DAMAGE;
/**
* @deprecated in favor of {@link #ENTITY_DIE}
*/
@Deprecated(since = "1.19")
public static final GameEvent ENTITY_DYING = ENTITY_DIE;
/**
* @deprecated in favor of {@link #ENTITY_DIE}
*/
@Deprecated(since = "1.19")
public static final GameEvent ENTITY_KILLED = ENTITY_DIE;
/**
* @deprecated in favor of {@link #ENTITY_ACTION}
*/
@Deprecated(since = "1.20.2")
public static final GameEvent ENTITY_ROAR = ENTITY_ACTION;
/**
* @deprecated in favor of {@link #ENTITY_ACTION}
*/
@Deprecated(since = "1.20.2")
public static final GameEvent ENTITY_SHAKE = ENTITY_ACTION;
/**
* @deprecated in favor of {@link #ENTITY_INTERACT}
*/
@Deprecated(since = "1.19")
public static final GameEvent MOB_INTERACT = ENTITY_INTERACT;
/**
* @deprecated in favor of {@link #BLOCK_DEACTIVATE}
*/
@Deprecated(since = "1.20")
public static final GameEvent PISTON_CONTRACT = BLOCK_DEACTIVATE;
/**
* @deprecated in favor of {@link #BLOCK_ACTIVATE}
*/
@Deprecated(since = "1.20")
public static final GameEvent PISTON_EXTEND = BLOCK_ACTIVATE;
/**
* @deprecated in favor of {@link #ENTITY_ACTION}
*/
@Deprecated(since = "1.19")
public static final GameEvent RAVAGER_ROAR = ENTITY_ACTION;
/**
* @deprecated in favor of {@link #BLOCK_CHANGE}
*/
@Deprecated(since = "1.19")
public static final GameEvent RING_BELL = BLOCK_CHANGE;
/**
* @deprecated in favor of {@link #CONTAINER_CLOSE}
*/
@Deprecated(since = "1.19")
public static final GameEvent SHULKER_CLOSE = CONTAINER_CLOSE;
/**
* @deprecated in favor of {@link #CONTAINER_OPEN}
*/
@Deprecated(since = "1.19")
public static final GameEvent SHULKER_OPEN = CONTAINER_OPEN;
/**
* @deprecated in favor of {@link #ENTITY_ACTION}
*/
@Deprecated(since = "1.19")
public static final GameEvent WOLF_SHAKING = ENTITY_ACTION;
/**
* Returns a {@link GameEvent} by a {@link NamespacedKey}.
*
* @param namespacedKey the key
* @return the event or null
* @deprecated Use {@link Registry#get(NamespacedKey)} instead.
*/
@Nullable
@Deprecated(since = "1.20.1")
public static GameEvent getByKey(@NotNull NamespacedKey namespacedKey) {
return Registry.GAME_EVENT.get(namespacedKey);
}
/**
* Returns the set of all GameEvents.
*
* @return the memoryKeys
* @deprecated use {@link Registry#stream()}.
*/
@NotNull
@Deprecated(since = "1.20.1")
public static Collection<GameEvent> values() {
return Registry.GAME_EVENT.stream().toList();
}
@NotNull
private static GameEvent getEvent(@NotNull @KeyPattern.Value String key) {
return Registry.GAME_EVENT.getOrThrow(Key.key(Key.MINECRAFT_NAMESPACE, key));
}
// Paper start
/**
* Gets the range of the event which is used to
* notify listeners of the event.
*
* @return the range
*/
public abstract int getRange();
/**
* Gets the vibration level of the game event for vibration listeners.
* Not all events have vibration levels, and a level of 0 means
* it won't cause any vibrations.
*
* @return the vibration level
*/
public abstract int getVibrationLevel();
// Paper end
}