diff options
-rw-r--r-- | .classpath | 2 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/util/Utils.java | 49 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java | 10 |
3 files changed, 44 insertions, 17 deletions
diff --git a/.classpath b/.classpath index f64ee72b03..37602a4409 100644 --- a/.classpath +++ b/.classpath @@ -13,6 +13,6 @@ <classpathentry kind="lib" path="libs/Baubles-deobf-1.7.10-1.0.1.10.jar"/> <classpathentry kind="lib" path="libs/forestry_1.7.10-4.2.2.50-deobf.jar"/> <classpathentry kind="lib" path="libs/industrialcraft-2-2.2.783-experimental-deobf.jar"/> - <classpathentry kind="lib" path="libs/gregtech_1.7.10-5.08.30-dev.jar"/> + <classpathentry kind="lib" path="libs/gregtech-5.09.23-NoTC-dev.jar"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/src/Java/gtPlusPlus/core/util/Utils.java b/src/Java/gtPlusPlus/core/util/Utils.java index 090d05e3b1..bee5de98ea 100644 --- a/src/Java/gtPlusPlus/core/util/Utils.java +++ b/src/Java/gtPlusPlus/core/util/Utils.java @@ -44,6 +44,9 @@ import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; + +import org.apache.commons.lang3.EnumUtils; + import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.registry.EntityRegistry; @@ -90,32 +93,52 @@ public class Utils { if (aspect.toUpperCase() == "COGNITIO"){ //Adds in Compat for older GT Versions which Misspell aspects. try { - returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITIO"), size); + if (EnumUtils.isValidEnum(TC_Aspects.class, "COGNITIO")){ + Utils.LOG_WARNING("TC Aspect found - "+aspect); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITIO"), size); + } + else { + Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITO"), size); + } } catch (NoSuchFieldError r){ - Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("COGNITO"), size); - + Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } } else if (aspect.toUpperCase() == "EXANIMUS"){ - //Adds in Compat for older GT Versions which Misspell aspects. + //Adds in Compat for older GT Versions which Misspell aspects. try { - returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXANIMUS"), size); + if (EnumUtils.isValidEnum(TC_Aspects.class, "EXANIMUS")){ + Utils.LOG_WARNING("TC Aspect found - "+aspect); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXANIMUS"), size); + } + else { + Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXAMINIS"), size); + } } catch (NoSuchFieldError r){ - Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("EXAMINIS"), size); + Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); } + + } else if (aspect.toUpperCase() == "PRAECANTATIO"){ - //Adds in Compat for older GT Versions which Misspell aspects. + //Adds in Compat for older GT Versions which Misspell aspects. try { - returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTATIO"), size); + if (EnumUtils.isValidEnum(TC_Aspects.class, "PRAECANTATIO")){ + Utils.LOG_WARNING("TC Aspect found - "+aspect); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTATIO"), size); + } + else { + Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); + returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTIO"), size); + } } catch (NoSuchFieldError r){ - Utils.LOG_INFO("Fallback TC Aspect found - "+aspect+" - PLEASE UPDATE GREGTECH TO A NEWER VERSION TO REMOVE THIS MESSAGE - THIS IS NOT AN ERROR"); - returnValue = new TC_AspectStack(TC_Aspects.valueOf("PRAECANTIO"), size); - } + Utils.LOG_INFO("Invalid Thaumcraft Aspects - Report this issue to Alkalus"); + } } else { + Utils.LOG_WARNING("TC Aspect found - "+aspect); returnValue = new TC_AspectStack(TC_Aspects.valueOf(aspect), size); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java index 585987797c..e9947464be 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaPipeEntityBase_Cable.java @@ -16,6 +16,7 @@ import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Proxy; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; @@ -71,13 +72,14 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements } private int getGT5Var(){ - Class clazz = GT_Mod.gregtechproxy.getClass(); + Class<? extends GT_Proxy> clazz = GT_Mod.gregtechproxy.getClass(); String lookingForValue = "mWireHeatingTicks"; int temp = 4; Field field; + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ try { field = clazz.getClass().getField(lookingForValue); - Class clazzType = field.getType(); + Class<?> clazzType = field.getType(); if (clazzType.toString().equals("int")){ temp = (field.getInt(clazz)); } @@ -85,10 +87,12 @@ public class GregtechMetaPipeEntityBase_Cable extends MetaPipeEntity implements temp = 4; } } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { - Utils.LOG_INFO("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); + //Utils.LOG_INFO("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); Utils.LOG_WARNING("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); Utils.LOG_ERROR("FATAL ERROR - REFLECTION FAILED FOR GT CABLES - PLEASE REPORT THIS."); + temp = 4; } + } return temp; } |