2013-05-07 22:12:07 +02:00
|
|
|
package ic2.api.reactor;
|
2013-04-13 16:35:13 +02:00
|
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
|
|
|
public class IC2Reactor {
|
|
|
|
private static Field energyGeneratorNuclear;
|
2013-05-07 22:12:07 +02:00
|
|
|
|
2013-04-13 16:35:13 +02:00
|
|
|
public static int getEUOutput() {
|
|
|
|
try {
|
|
|
|
if (energyGeneratorNuclear == null) energyGeneratorNuclear = Class.forName(getPackage() + ".core.IC2").getDeclaredField("energyGeneratorNuclear");
|
2013-05-07 22:12:07 +02:00
|
|
|
|
2013-04-13 16:35:13 +02:00
|
|
|
return energyGeneratorNuclear.getInt(null);
|
|
|
|
} catch (Throwable e) {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
|
|
|
}
|
2013-05-07 22:12:07 +02:00
|
|
|
|
2013-04-13 16:35:13 +02:00
|
|
|
/**
|
|
|
|
* Get the base IC2 package name, used internally.
|
|
|
|
*
|
|
|
|
* @return IC2 package name, if unable to be determined defaults to ic2
|
|
|
|
*/
|
|
|
|
private static String getPackage() {
|
|
|
|
Package pkg = IC2Reactor.class.getPackage();
|
2013-05-07 22:12:07 +02:00
|
|
|
|
|
|
|
if (pkg != null) {
|
|
|
|
String packageName = pkg.getName();
|
|
|
|
|
|
|
|
return packageName.substring(0, packageName.length() - ".api.reactor".length());
|
|
|
|
}
|
|
|
|
|
|
|
|
return "ic2";
|
2013-04-13 16:35:13 +02:00
|
|
|
}
|
|
|
|
}
|