From 9781ccd9ee09f0f9039465096e09b0544b7eebdd Mon Sep 17 00:00:00 2001 From: Blood-Asp Date: Mon, 21 Dec 2015 18:44:07 +0100 Subject: [PATCH] fix crash without rf api --- src/main/java/gregtech/GT_Mod.java | 20 +++++++++---------- .../java/gregtech/api/util/GT_Utility.java | 7 ++++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 1ce784a8..1ee700cd 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -238,17 +238,6 @@ public class GT_Mod GregTech_API.mRFtoEU = GregTech_API.sOPStuff.get(ConfigCategories.general, "100RFtoEU", 20); GregTech_API.mRFExplosions = GregTech_API.sOPStuff.get(ConfigCategories.general, "RFExplosions", false); GregTech_API.meIOLoaded = Loader.isModLoaded("EnderIO"); - - if(GregTech_API.mOutputRF||GregTech_API.mInputRF){ - try { - Class tClass = cofh.api.energy.IEnergyReceiver.class; - tClass.getCanonicalName(); - } catch (Exception e) { - GregTech_API.mOutputRF = false; - GregTech_API.mInputRF = false; - System.err.println("RF API not found"); - } - } gregtechproxy.mChangeHarvestLevels = GregTech_API.sMaterialProperties.get("havestLevel", "activateHarvestLevelChange", false); if(gregtechproxy.mChangeHarvestLevels){ @@ -680,6 +669,15 @@ public class GT_Mod } } } + + if(GregTech_API.mOutputRF||GregTech_API.mInputRF){ + GT_Utility.checkAvailabilities(); + if(!GT_Utility.RF_CHECK){ + GregTech_API.mOutputRF = false; + GregTech_API.mInputRF = false; + } + } + achievements = new GT_Achievements(); Map.Entry tRecipe; GT_Log.out.println("GT_Mod: Loading finished, deallocating temporary Init Variables."); diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 766f3b6b..b6fa328b 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -85,7 +85,7 @@ public class GT_Utility { private static final Map sFilledContainerToData = new HashMap(); private static final Map> sEmptyContainerToFluidToData = new HashMap>(); public static volatile int VERSION = 509; - public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true; + public static boolean TE_CHECK = false, BC_CHECK = false, CHECK_ALL = true, RF_CHECK = false; public static Map sPlayedSoundMap = new HashMap(); private static int sBookCount = 0; @@ -336,6 +336,11 @@ public class GT_Utility { tClass.getCanonicalName(); BC_CHECK = true; } catch (Throwable e) {/**/} + try { + Class tClass = cofh.api.energy.IEnergyReceiver.class; + tClass.getCanonicalName(); + RF_CHECK = true; + } catch (Throwable e) {/**/} CHECK_ALL = false; } }