diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-13 00:28:02 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-13 00:28:02 +0000 |
commit | 3e519e890249825dc8face0087cc631684d36e8c (patch) | |
tree | 33f667dc118da284af154ffbfe9f926ff55928a8 /src/main/java/gtPlusPlus/core | |
parent | b72a9b138fafceab899c1bd86fee64decb9fb98a (diff) | |
download | GT5-Unofficial-3e519e890249825dc8face0087cc631684d36e8c.tar.gz GT5-Unofficial-3e519e890249825dc8face0087cc631684d36e8c.tar.bz2 GT5-Unofficial-3e519e890249825dc8face0087cc631684d36e8c.zip |
Basically finished work on Reactor Simulator.
Diffstat (limited to 'src/main/java/gtPlusPlus/core')
-rw-r--r-- | src/main/java/gtPlusPlus/core/lib/LoadedMods.java | 15 | ||||
-rw-r--r-- | src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java | 26 |
2 files changed, 33 insertions, 8 deletions
diff --git a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java index 15b0d8629c..8d20f2ff67 100644 --- a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java @@ -62,10 +62,11 @@ public class LoadedMods { public static boolean CropsPlusPlus = false; //Barts Crop Mod public static boolean Reliquary = false; public static boolean SpiceOfLife = false; - - + public static boolean BartWorks = false; + public static boolean GoodGenerator = false; private static int totalMods; + @SuppressWarnings("deprecation") public static void checkLoaded(){ Logger.INFO("Looking for optional mod prereqs."); @@ -124,6 +125,16 @@ public class LoadedMods { Logger.INFO("Components enabled for: Advanced Solar Panels"); totalMods++; } + if (isModLoaded("GoodGenerator")) { + GoodGenerator = true; + Logger.INFO("Components enabled for: GoodGenerator"); + totalMods++; + } + if (isModLoaded("bartworks")) { + BartWorks = true; + Logger.INFO("Components enabled for: BartWorks"); + totalMods++; + } if (isModLoaded("BuildCraft")){ BuildCraft = true; Logger.INFO("Components enabled for: BuildCraft"); diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index aaec2024e4..f3890aa932 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -22,7 +22,6 @@ import com.google.common.reflect.ClassPath; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.util.data.StringUtils; -import gtPlusPlus.xmod.gregtech.common.StaticFields59; public class ReflectionUtils { @@ -271,6 +270,21 @@ public class ReflectionUtils { } } + public static Field[] getAllFields(final Class<?> aClass) { + if (aClass == null) { + return null; + } + Field[] aFields = aClass.getDeclaredFields(); + for (Field f : aFields) { + CachedField y = mCachedFields.get(aClass.getName()+"."+f.getName()); + if (y == null) { + makeFieldAccessible(f); + cacheField(aClass, f); + } + } + return aFields; + } + /** * Returns a cached {@link Field} object. * @param aInstance - {@link Object} to get the field instance from. @@ -435,7 +449,7 @@ public class ReflectionUtils { t.printStackTrace(); } } - + /** * Allows to change the state of an immutable instance. Huh?!? */ @@ -523,7 +537,7 @@ public class ReflectionUtils { Logger.REFLECTION("Invoke failed or did something wrong."); return false; } - + public static boolean invokeVoid(Object objectInstance, Method method, Object[] values){ if (method == null || values == null || (!ReflectionUtils.isStaticMethod(method) && objectInstance == null)){ //Logger.REFLECTION("Null value when trying to Dynamically invoke "+methodName+" on an object of type: "+objectInstance.getClass().getName()); @@ -537,8 +551,8 @@ public class ReflectionUtils { if (mInvokingMethod != null){ Logger.REFLECTION(methodName+" was not null."); mInvokingMethod.invoke(objectInstance, values); - Logger.REFLECTION("Successfully invoked "+methodName+"."); - return true; + Logger.REFLECTION("Successfully invoked "+methodName+"."); + return true; } } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { @@ -583,7 +597,7 @@ public class ReflectionUtils { String classname = objectInstance != null ? objectInstance.getClass().getCanonicalName() : method.getDeclaringClass().getCanonicalName(); Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+classname+"."); try { - return method.invoke(objectInstance, values); + return method.invoke(objectInstance, values); } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+classname); |