diff options
author | Alkalus <draknyte1@hotmail.com> | 2017-07-10 09:56:52 +1000 |
---|---|---|
committer | Alkalus <draknyte1@hotmail.com> | 2017-07-10 09:56:52 +1000 |
commit | 5b687d5533ce4449a14f170d3b3b582075b15fa6 (patch) | |
tree | aad24d1f14efd091feab5d1895f449c28d0a2ad2 /src/Java/gtPlusPlus/core | |
parent | df9291355838fc71a6874399f2ab797ad1e1e635 (diff) | |
download | GT5-Unofficial-5b687d5533ce4449a14f170d3b3b582075b15fa6.tar.gz GT5-Unofficial-5b687d5533ce4449a14f170d3b3b582075b15fa6.tar.bz2 GT5-Unofficial-5b687d5533ce4449a14f170d3b3b582075b15fa6.zip |
$ Fixed an NPE thrown via reflection.
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r-- | src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java b/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java index 19c09a8c21..98dfbf1f96 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java +++ b/src/Java/gtPlusPlus/core/util/reflect/AddGregtechRecipe.java @@ -3,6 +3,8 @@ package gtPlusPlus.core.util.reflect; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.internal.IGT_RecipeAdder; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; @@ -12,15 +14,16 @@ public final class AddGregtechRecipe { final FluidStack p4, final int p5, final int p6){ try { - Class<?> GT_RecipeAdder = Class.forName("gregtech.common.GT_RecipeAdder"); - if (GT_RecipeAdder != null){ - Method addPollution = GT_RecipeAdder.getMethod("addPyrolyseRecipe", ItemStack.class, FluidStack.class, int.class, ItemStack.class, FluidStack.class, int.class, int.class); - if (addPollution != null){ - return (boolean) addPollution.invoke(p0, p1, p2, p3, p4, p5, p6); + IGT_RecipeAdder IGT_RecipeAdder = GT_Values.RA; + if (IGT_RecipeAdder != null){ + Class classRA = IGT_RecipeAdder.getClass(); + Method addRecipe = classRA.getMethod("addPyrolyseRecipe", ItemStack.class, FluidStack.class, int.class, ItemStack.class, FluidStack.class, int.class, int.class); + if (addRecipe != null){ + return (boolean) addRecipe.invoke(IGT_RecipeAdder, p0, p1, p2, p3, p4, p5, p6); } } } - catch (ClassNotFoundException | SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + catch (SecurityException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { return false; } return false; |