Modify way nms Particle is fetched
This commit is contained in:
parent
b51ab2345b
commit
0b21e88f0d
@ -842,7 +842,16 @@ public class ReflectionManager {
|
|||||||
|
|
||||||
private static Object getParticleType(Particle particle) {
|
private static Object getParticleType(Particle particle) {
|
||||||
try {
|
try {
|
||||||
return getCraftClass("CraftParticle").getMethod("toNMS", Particle.class).invoke(null, particle);
|
Class craftParticle = getCraftClass("CraftParticle");
|
||||||
|
Field mcKeyField = craftParticle.getDeclaredField("minecraftKey");
|
||||||
|
mcKeyField.setAccessible(true);
|
||||||
|
Object mcKey = mcKeyField.get(Enum.valueOf(craftParticle, particle.name()));
|
||||||
|
|
||||||
|
Class typesClass = getNmsClass("IRegistry");
|
||||||
|
|
||||||
|
Object registry = typesClass.getField("PARTICLE_TYPE").get(null);
|
||||||
|
|
||||||
|
return registry.getClass().getMethod("get", mcKey.getClass()).invoke(registry, mcKey);
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -928,9 +937,10 @@ public class ReflectionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Object createMinecraftKey(String name) {
|
public static Object createMinecraftKey(String name) {
|
||||||
try{
|
try {
|
||||||
return getNmsClass("MinecraftKey").getConstructor(String.class).newInstance(name);
|
return getNmsClass("MinecraftKey").getConstructor(String.class).newInstance(name);
|
||||||
}catch(Exception ex) {
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user