diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core')
-rw-r--r-- | src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java | 4 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/lib/LoadedMods.java | 6 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java | 50 |
3 files changed, 60 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java index 740f923c6f..f788e3b0e4 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -8,6 +8,7 @@ import gtPlusPlus.xmod.growthcraft.HANDLER_GC; import gtPlusPlus.xmod.ic2.HANDLER_IC2; import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft; import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF; +import gtPlusPlus.xmod.tinkers.HANDLER_Tinkers; public class COMPAT_IntermodStaging { @@ -21,6 +22,7 @@ public class COMPAT_IntermodStaging { HANDLER_BiomesOPlenty.preInit(); //HANDLER_Mekanism.preInit(); HANDLER_Thaumcraft.preInit(); + HANDLER_Tinkers.preInit(); } public static void init(){ @@ -33,6 +35,7 @@ public class COMPAT_IntermodStaging { HANDLER_BiomesOPlenty.init(); //HANDLER_Mekanism.init(); HANDLER_Thaumcraft.init(); + HANDLER_Tinkers.init(); } public static void postInit(){ @@ -45,6 +48,7 @@ public class COMPAT_IntermodStaging { HANDLER_BiomesOPlenty.postInit(); //HANDLER_Mekanism.postInit(); HANDLER_Thaumcraft.postInit(); + HANDLER_Tinkers.postInit(); } diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index 114219486e..81cae14a6b 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -49,6 +49,7 @@ public class LoadedMods { public static boolean Mekanism = false; public static boolean RedTech = false; //RedMage's Mod public static boolean TecTech = false; //Technus' Mod + public static boolean TiCon = false; @@ -91,6 +92,11 @@ public class LoadedMods { Logger.INFO("Components enabled for: PlayerAPI"); totalMods++; } + if (Loader.isModLoaded("TConstruct") == true){ + TiCon = true; + Logger.INFO("Components enabled for: Tinkers Construct"); + totalMods++; + } if (Loader.isModLoaded("BuildCraft") == true){ BuildCraft = true; Logger.INFO("Components enabled for: BuildCraft"); diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index d17c861b77..882d16c232 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -203,6 +203,56 @@ public class ReflectionUtils { Logger.REFLECTION("Invoke failed or did something wrong."); return false; } + + public static boolean invokeVoid(Object objectInstance, String methodName, Class[] parameters, Object[] values){ + if (objectInstance == null || methodName == null || parameters == null || values == null){ + return false; + } + Class<?> mLocalClass = (objectInstance instanceof Class ? (Class<?>) objectInstance : objectInstance.getClass()); + Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+mLocalClass.getCanonicalName()+"."); + try { + Method mInvokingMethod = mLocalClass.getDeclaredMethod(methodName, parameters); + if (mInvokingMethod != null){ + Logger.REFLECTION(methodName+" was not null."); + mInvokingMethod.invoke(objectInstance, values); + Logger.REFLECTION("Successfully invoked "+methodName+"."); + return true; + } + else { + Logger.REFLECTION(methodName+" is null."); + } + } + catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName()); + } + + Logger.REFLECTION("Invoke failed or did something wrong."); + return false; + } + + public static Object invokeNonBool(Object objectInstance, String methodName, Class[] parameters, Object[] values){ + if (objectInstance == null || methodName == null || parameters == null || values == null){ + return false; + } + Class<?> mLocalClass = (objectInstance instanceof Class ? (Class<?>) objectInstance : objectInstance.getClass()); + Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+mLocalClass.getCanonicalName()+"."); + try { + Method mInvokingMethod = mLocalClass.getDeclaredMethod(methodName, parameters); + if (mInvokingMethod != null){ + Logger.REFLECTION(methodName+" was not null."); + return mInvokingMethod.invoke(objectInstance, values); + } + else { + Logger.REFLECTION(methodName+" is null."); + } + } + catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName()); + } + + Logger.REFLECTION("Invoke failed or did something wrong."); + return null; + } /* * @ if (isPresent("com.optionaldependency.DependencyClass")) { // This |