aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-10-26 01:04:30 +0100
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-10-26 01:04:30 +0100
commitb9ad7d46f1f1993add94ad7b561e1fea94a4e0d1 (patch)
treeff509e8d7226ad3bd789cc38dd9bb9d8ca0a4553 /src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
parent7e09b5381593a23aeff0a0bab03926a8c1e2b87d (diff)
downloadGT5-Unofficial-b9ad7d46f1f1993add94ad7b561e1fea94a4e0d1.tar.gz
GT5-Unofficial-b9ad7d46f1f1993add94ad7b561e1fea94a4e0d1.tar.bz2
GT5-Unofficial-b9ad7d46f1f1993add94ad7b561e1fea94a4e0d1.zip
% Updated 5.08 compatibility.
> Created StaticFields59.java to hold static copies of fields gotten from gt 5.09 classes. ^ Version bump.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
new file mode 100644
index 0000000000..15c6a519b1
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java
@@ -0,0 +1,74 @@
+package gtPlusPlus.xmod.gregtech.common;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import net.minecraft.block.Block;
+
+public class StaticFields59 {
+
+ public static final Field mGtBlockCasings5;
+ public static final Field mPreventableComponents;
+ public static final Field mDisabledItems;
+ public static final Method mCalculatePollutionReduction;
+
+ //OrePrefixes
+
+ static {
+ mGtBlockCasings5 = getField(GregTech_API.class, "sBlockCasings5");
+ mPreventableComponents = getField(OrePrefixes.class, "mPreventableComponents");
+ mDisabledItems = getField(OrePrefixes.class, "mDisabledItems");
+ mCalculatePollutionReduction = getMethod(GT_MetaTileEntity_Hatch_Muffler.class, "calculatePollutionReduction", int.class);
+ }
+
+ public static synchronized final Block getBlockCasings5() {
+ try {
+ return (Block) mGtBlockCasings5.get(GregTech_API.class);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return null;
+ }
+ }
+
+ public static int calculatePollutionReducation(GT_MetaTileEntity_Hatch_Muffler h, int i) {
+ try {
+ return (int) mCalculatePollutionReduction.invoke(h, i);
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ return 0;
+ }
+ }
+
+ public static Field getField(Class a, String b) {
+ try {
+ return ReflectionUtils.getField(a, b);
+ } catch (NoSuchFieldException e) {
+ return null;
+ }
+ }
+
+ public static Method getMethod(Class a, String b, Class... params) {
+ return ReflectionUtils.getMethod(a, b, params);
+ }
+
+ public static synchronized final Boolean getOrePrefixesBooleanDisabledItems() {
+ try {
+ return (Boolean) mDisabledItems.get(OrePrefixes.class);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return false;
+ }
+ }
+
+ public static synchronized final Boolean geOrePrefixesBooleanPreventableComponents() {
+ try {
+ return (Boolean) mPreventableComponents.get(OrePrefixes.class);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ return false;
+ }
+ }
+
+
+}