22
22
* SOFTWARE.
23
23
*/
24
24
25
- package xyz . xenondevs .particle ;
25
+ package com . georgev22 .particle ;
26
26
27
27
import org .bukkit .inventory .ItemStack ;
28
28
29
29
import java .lang .reflect .Constructor ;
30
30
import java .lang .reflect .Field ;
31
31
import java .lang .reflect .Method ;
32
32
33
- import static xyz . xenondevs .particle .ParticleMappings .*;
34
- import static xyz . xenondevs .particle .utils .ReflectionUtils .*;
33
+ import static com . georgev22 .particle .ParticleMappings .*;
34
+ import static com . georgev22 .particle .utils .ReflectionUtils .*;
35
35
36
36
/**
37
37
* Constants for particles.
40
40
* @since 10.06.2019
41
41
*/
42
42
public final class ParticleConstants {
43
-
43
+
44
44
/* ---------------- Classes ---------------- */
45
-
45
+
46
46
/**
47
47
* Represents the ItemStack class.
48
48
*/
@@ -167,9 +167,9 @@ public final class ParticleConstants {
167
167
* Represents the ParticleParamSculkCharge class.
168
168
*/
169
169
public static final Class PARTICLE_PARAM_SCULK_CHARGE_CLASS ;
170
-
170
+
171
171
/* ---------------- Methods ---------------- */
172
-
172
+
173
173
/**
174
174
* Represents the IRegistry#get(MinecraftKey) method.
175
175
*/
@@ -194,16 +194,16 @@ public final class ParticleConstants {
194
194
* Represents the CraftItemStack#asNMSCopy(); method.
195
195
*/
196
196
public static final Method CRAFT_ITEM_STACK_AS_NMS_COPY_METHOD ;
197
-
197
+
198
198
/* ---------------- Fields ---------------- */
199
-
199
+
200
200
/**
201
201
* Represents the EntityPlayer#playerConnection field.
202
202
*/
203
203
public static final Field ENTITY_PLAYER_PLAYER_CONNECTION_FIELD ;
204
-
204
+
205
205
/* ---------------- Constructor ---------------- */
206
-
206
+
207
207
/**
208
208
* Represents the PacketPlayOutWorldParticles constructor.
209
209
*/
@@ -260,10 +260,10 @@ public final class ParticleConstants {
260
260
* Represents the ParticleParamSculkCharge constructor.
261
261
*/
262
262
public static final Constructor PARTICLE_PARAM_SCULK_CHARGE_CONSTRUCTOR ;
263
-
264
-
263
+
264
+
265
265
/* ---------------- Object constants ---------------- */
266
-
266
+
267
267
/**
268
268
* Represents the ParticleType Registry.
269
269
*/
@@ -272,12 +272,12 @@ public final class ParticleConstants {
272
272
* Represents the Block Registry.
273
273
*/
274
274
public static final Object BLOCK_REGISTRY ;
275
-
275
+
276
276
/* ---------------- INIT ---------------- */
277
-
277
+
278
278
static {
279
279
double version = MINECRAFT_VERSION ;
280
-
280
+
281
281
// Classes
282
282
ITEM_STACK_CLASS = getMappedClass ("ItemStack" );
283
283
PACKET_CLASS = getMappedClass ("Packet" );
@@ -310,26 +310,26 @@ public final class ParticleConstants {
310
310
PARTICLE_PARAM_VIBRATION_CLASS = getMappedClass ("ParticleParamVibration" );
311
311
PARTICLE_PARAM_SHRIEK_CLASS = getMappedClass ("ParticleParamShriek" );
312
312
PARTICLE_PARAM_SCULK_CHARGE_CLASS = getMappedClass ("ParticleParamSculkCharge" );
313
-
313
+
314
314
// Methods
315
315
REGISTRY_GET_METHOD = getMappedMethod (REGISTRY_CLASS , "Registry.get" , MINECRAFT_KEY_CLASS );
316
316
PLAYER_CONNECTION_SEND_PACKET_METHOD = getMappedMethod (PLAYER_CONNECTION_CLASS , "PlayerConnection.sendPacket" , PACKET_CLASS );
317
317
CRAFT_ENTITY_GET_HANDLE_METHOD = getMethodOrNull (CRAFT_ENTITY_CLASS , "getHandle" );
318
318
CRAFT_PLAYER_GET_HANDLE_METHOD = getMethodOrNull (CRAFT_PLAYER_CLASS , "getHandle" );
319
319
BLOCK_GET_BLOCK_DATA_METHOD = getMappedMethod (BLOCK_CLASS , "Block.getBlockData" );
320
320
CRAFT_ITEM_STACK_AS_NMS_COPY_METHOD = getMethodOrNull (CRAFT_ITEM_STACK_CLASS , "asNMSCopy" , ItemStack .class );
321
-
321
+
322
322
// Fields
323
323
ENTITY_PLAYER_PLAYER_CONNECTION_FIELD = getMappedField (ENTITY_PLAYER_CLASS , "EntityPlayer.playerConnection" , false );
324
-
324
+
325
325
// Constructors
326
326
if (version < 13 )
327
327
PACKET_PLAY_OUT_WORLD_PARTICLES_CONSTRUCTOR = getConstructorOrNull (PACKET_PLAY_OUT_WORLD_PARTICLES_CLASS , PARTICLE_ENUM , boolean .class , float .class , float .class , float .class , float .class , float .class , float .class , float .class , int .class , int [].class );
328
328
else if (version < 15 )
329
329
PACKET_PLAY_OUT_WORLD_PARTICLES_CONSTRUCTOR = getConstructorOrNull (PACKET_PLAY_OUT_WORLD_PARTICLES_CLASS , PARTICLE_PARAM_CLASS , boolean .class , float .class , float .class , float .class , float .class , float .class , float .class , float .class , int .class );
330
330
else
331
331
PACKET_PLAY_OUT_WORLD_PARTICLES_CONSTRUCTOR = getConstructorOrNull (PACKET_PLAY_OUT_WORLD_PARTICLES_CLASS , PARTICLE_PARAM_CLASS , boolean .class , double .class , double .class , double .class , float .class , float .class , float .class , float .class , int .class );
332
-
332
+
333
333
MINECRAFT_KEY_CONSTRUCTOR = getConstructorOrNull (MINECRAFT_KEY_CLASS , String .class );
334
334
VECTOR_3FA_CONSTRUCTOR = getConstructorOrNull (VECTOR_3FA_CLASS , float .class , float .class , float .class );
335
335
BLOCK_POSITION_CONSTRUCTOR = getConstructorOrNull (BLOCK_POSITION_CLASS , double .class , double .class , double .class );
@@ -340,16 +340,16 @@ else if (version < 19)
340
340
ENTITY_POSITION_SOURCE_CONSTRUCTOR = getConstructorOrNull (ENTITY_POSITION_SOURCE_CLASS , int .class );
341
341
else
342
342
ENTITY_POSITION_SOURCE_CONSTRUCTOR = getConstructorOrNull (ENTITY_POSITION_SOURCE_CLASS , ENTITY_CLASS , float .class );
343
-
343
+
344
344
VIBRATION_PATH_CONSTRUCTOR = version < 17 ? null : getConstructorOrNull (VIBRATION_PATH_CLASS , BLOCK_POSITION_CLASS , POSITION_SOURCE_CLASS , int .class );
345
-
345
+
346
346
if (version < 13 )
347
347
PARTICLE_PARAM_REDSTONE_CONSTRUCTOR = null ;
348
348
else if (version < 17 )
349
349
PARTICLE_PARAM_REDSTONE_CONSTRUCTOR = getConstructorOrNull (PARTICLE_PARAM_REDSTONE_CLASS , float .class , float .class , float .class , float .class );
350
350
else
351
351
PARTICLE_PARAM_REDSTONE_CONSTRUCTOR = getConstructorOrNull (PARTICLE_PARAM_REDSTONE_CLASS , VECTOR_3FA_CLASS , float .class );
352
-
352
+
353
353
PARTICLE_PARAM_DUST_COLOR_TRANSITION_CONSTRUCTOR = version < 17 ? null : getConstructorOrNull (PARTICLE_PARAM_DUST_COLOR_TRANSITION_CLASS , VECTOR_3FA_CLASS , VECTOR_3FA_CLASS , float .class );
354
354
PARTICLE_PARAM_BLOCK_CONSTRUCTOR = version < 13 ? null : getConstructorOrNull (PARTICLE_PARAM_BLOCK_CLASS , PARTICLE_CLASS , BLOCK_DATA_INTERFACE );
355
355
PARTICLE_PARAM_ITEM_CONSTRUCTOR = version < 13 ? null : getConstructorOrNull (PARTICLE_PARAM_ITEM_CLASS , PARTICLE_CLASS , ITEM_STACK_CLASS );
@@ -361,18 +361,18 @@ else if (version < 19)
361
361
PARTICLE_PARAM_VIBRATION_CONSTRUCTOR = getConstructorOrNull (PARTICLE_PARAM_VIBRATION_CLASS , POSITION_SOURCE_CLASS , int .class );
362
362
PARTICLE_PARAM_SHRIEK_CONSTRUCTOR = version < 19 ? null : getConstructorOrNull (PARTICLE_PARAM_SHRIEK_CLASS , int .class );
363
363
PARTICLE_PARAM_SCULK_CHARGE_CONSTRUCTOR = version < 19 ? null : getConstructorOrNull (PARTICLE_PARAM_SCULK_CHARGE_CLASS , float .class );
364
-
364
+
365
365
// Constants
366
366
PARTICLE_TYPE_REGISTRY = readField (
367
- version < 19.3
368
- ? getMappedField (REGISTRY_CLASS , "Registry.ParticleTypeRegistry" , false )
369
- : getMappedField (BUILT_IN_REGISTRIES_CLASS , "BuiltInRegistries.ParticleTypeRegistry" , false ),
370
- null );
367
+ version < 19.3
368
+ ? getMappedField (REGISTRY_CLASS , "Registry.ParticleTypeRegistry" , false )
369
+ : getMappedField (BUILT_IN_REGISTRIES_CLASS , "BuiltInRegistries.ParticleTypeRegistry" , false ),
370
+ null );
371
371
BLOCK_REGISTRY = readField (
372
- version < 19.3
373
- ? getMappedField (REGISTRY_CLASS , "Registry.BlockRegistry" , false )
374
- : getMappedField (BUILT_IN_REGISTRIES_CLASS , "BuiltInRegistries.BlockRegistry" , false ),
375
- null );
372
+ version < 19.3
373
+ ? getMappedField (REGISTRY_CLASS , "Registry.BlockRegistry" , false )
374
+ : getMappedField (BUILT_IN_REGISTRIES_CLASS , "BuiltInRegistries.BlockRegistry" , false ),
375
+ null );
376
376
}
377
-
377
+
378
378
}
0 commit comments