diff options
author | Alkalus <Draknyte1@hotmail.com> | 2020-03-31 01:25:58 +0100 |
---|---|---|
committer | Alkalus <Draknyte1@hotmail.com> | 2020-03-31 01:25:58 +0100 |
commit | 75ea33600537047847091b55a46f5b88c3c75dbb (patch) | |
tree | 3050dc52746859cb9003e09f75dc91a7d7eb5911 /src/Java/sun | |
parent | b5cbe510e959ae0fe8803b5df1031f2752c50e30 (diff) | |
download | GT5-Unofficial-75ea33600537047847091b55a46f5b88c3c75dbb.tar.gz GT5-Unofficial-75ea33600537047847091b55a46f5b88c3c75dbb.tar.bz2 GT5-Unofficial-75ea33600537047847091b55a46f5b88c3c75dbb.zip |
+ Added Custom NEI Handler for IsaMIll.
+ Added Death by IsaMIll.
% Moved debug mode switch to AsmConfig.
$ Fixed handling of custom OrePrefixes.
$ Fixed OreDict registration of MetaFoodItems.
$ Improved handling of Core Classes being static initialised too early.
$ Fixed client-side bug in Distillus which would cause an infinite loop.
$ Fixed bug in ForgeEnumHelper.
$ Fixed bug in setField methods from ReflectionUtils.
Diffstat (limited to 'src/Java/sun')
-rw-r--r-- | src/Java/sun/repackage/ForgeEnumHelper.java | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/src/Java/sun/repackage/ForgeEnumHelper.java b/src/Java/sun/repackage/ForgeEnumHelper.java index 8d77877cee..2f7732574c 100644 --- a/src/Java/sun/repackage/ForgeEnumHelper.java +++ b/src/Java/sun/repackage/ForgeEnumHelper.java @@ -5,17 +5,19 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.Preloader_Logger; +import net.minecraftforge.common.util.EnumHelper; -public class ForgeEnumHelper -{ +public class ForgeEnumHelper { private static Object reflectionFactory = null; private static Method newConstructorAccessor = null; private static Method newInstance = null; private static Method newFieldAccessor = null; private static Method fieldAccessorSet = null; private static boolean isSetup = false; + - private static void setup() + public static void setup() { if (isSetup) { @@ -25,18 +27,36 @@ public class ForgeEnumHelper try { + Preloader_Logger.INFO("Patching Fields in Forge's EnumHelper."); + Class aRefFac = ReflectionUtils.getClass("sun.repackage.ReflectionFactory"); Class aConAcc = ReflectionUtils.getClass("sun.repackage.ConstructorAccessor"); Class aFieAcc = ReflectionUtils.getClass("sun.repackage.FieldAccessor"); Method getReflectionFactory = ReflectionUtils.getMethod(aRefFac, "getReflectionFactory", new Class[] {}); - reflectionFactory = ReflectionUtils.invoke(aRefFac, getReflectionFactory, new Object[] {}); + reflectionFactory = ReflectionUtils.invokeNonBool(aRefFac, getReflectionFactory, new Object[] {}); newConstructorAccessor = ReflectionUtils.getMethod(aRefFac, "newConstructorAccessor", new Class[] {Constructor.class}); newFieldAccessor = ReflectionUtils.getMethod(aRefFac, "newFieldAccessor", new Class[] {Field.class, boolean.class}); newInstance = ReflectionUtils.getMethod(aConAcc, "newInstance", new Class[] {Object[].class}); fieldAccessorSet = ReflectionUtils.getMethod(aFieAcc, "set", new Class[] {Object.class, Object.class}); + + Field aIsSetup = ReflectionUtils.getField(EnumHelper.class, "isSetup"); + Field aReflectionFactory = ReflectionUtils.getField(EnumHelper.class, "reflectionFactory"); + Field aNewConstructorAccessor = ReflectionUtils.getField(EnumHelper.class, "newConstructorAccessor"); + Field aNewInstance = ReflectionUtils.getField(EnumHelper.class, "newInstance"); + Field aNewFieldAccessor = ReflectionUtils.getField(EnumHelper.class, "newFieldAccessor"); + Field aFieldAccessorSet = ReflectionUtils.getField(EnumHelper.class, "fieldAccessorSet"); + + ReflectionUtils.setField(EnumHelper.class, aIsSetup, true); + ReflectionUtils.setField(EnumHelper.class, aReflectionFactory, reflectionFactory); + ReflectionUtils.setField(EnumHelper.class, aNewConstructorAccessor, newConstructorAccessor); + ReflectionUtils.setField(EnumHelper.class, aNewInstance, newInstance); + ReflectionUtils.setField(EnumHelper.class, aNewFieldAccessor, newFieldAccessor); + ReflectionUtils.setField(EnumHelper.class, aFieldAccessorSet, fieldAccessorSet); + + Preloader_Logger.INFO("Finished patching Fields in Forge's EnumHelper."); - + Preloader_Logger.INFO("Testing: "+ReflectionUtils.getFieldValue(aReflectionFactory).getClass().getCanonicalName()); } catch (Exception e) @@ -47,11 +67,4 @@ public class ForgeEnumHelper isSetup = true; } - static - { - if (!isSetup) - { - setup(); - } - } }
\ No newline at end of file |