diff options
author | Jordan Byrne <draknyte1@hotmail.com> | 2017-12-10 15:37:46 +1000 |
---|---|---|
committer | Jordan Byrne <draknyte1@hotmail.com> | 2017-12-10 15:37:46 +1000 |
commit | 5a90d0ab107b4711b2b22aa3b2964ce7d669a216 (patch) | |
tree | d9ea8d2b4382f942ee08b9f52499f3bf20b6ed7f /src/Java/gtPlusPlus/core/handler | |
parent | 27c1a066d6aaa2c3c8f3847909323c78ab693e37 (diff) | |
download | GT5-Unofficial-5a90d0ab107b4711b2b22aa3b2964ce7d669a216.tar.gz GT5-Unofficial-5a90d0ab107b4711b2b22aa3b2964ce7d669a216.tar.bz2 GT5-Unofficial-5a90d0ab107b4711b2b22aa3b2964ce7d669a216.zip |
% Major Refactor of the base GT++ class.
% Moved Config Handling to it's own class.
% Renamed configSwitches.class to ConfigSwitches.class.
+ Added framework for Segment Analytics.
Diffstat (limited to 'src/Java/gtPlusPlus/core/handler')
3 files changed, 53 insertions, 3 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java b/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java new file mode 100644 index 0000000000..1c023b7304 --- /dev/null +++ b/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java @@ -0,0 +1,50 @@ +package gtPlusPlus.core.handler; + +import static gtPlusPlus.core.lib.CORE.ConfigSwitches.enableOldGTcircuits; + +import java.lang.reflect.Field; +import java.util.HashSet; + +import org.apache.commons.lang3.reflect.FieldUtils; + +import gregtech.api.enums.GT_Values; +import gregtech.api.util.EmptyRecipeMap; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + +public class OldCircuitHandler { + + public static void preInit(){ + if (enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ + removeCircuitRecipeMap(); //Bye shitty recipes. + } + } + + public static void init(){ + + } + + public static void postInit(){ + + } + + private static boolean removeCircuitRecipeMap(){ + try { + Utils.LOG_INFO("[Old Feature - Circuits] Trying to override the Circuit Assembler Recipe map, so that no recipes for new circuits get added."); + ReflectionUtils.setFinalStatic(GT_Recipe_Map.class.getDeclaredField("sCircuitAssemblerRecipes"), new EmptyRecipeMap(new HashSet<GT_Recipe>(0), "gt.recipe.removed", "Removed", null, GT_Values.RES_PATH_GUI + "basicmachines/Default", 0, 0, 0, 0, 0, GT_Values.E, 0, GT_Values.E, true, false)); + Field jaffar = GT_Recipe_Map.class.getDeclaredField("sCircuitAssemblerRecipes"); + FieldUtils.removeFinalModifier(jaffar, true); + jaffar.set(null, new EmptyRecipeMap(new HashSet<GT_Recipe>(0), "gt.recipe.removed", "Removed", null, GT_Values.RES_PATH_GUI + "basicmachines/Default", 0, 0, 0, 0, 0, GT_Values.E, 0, GT_Values.E, true, false)); + Utils.LOG_INFO("[Old Feature - Circuits] Successfully replaced circuit assembler recipe map with one that cannot hold recipes."); + } + catch (Exception e) { + Utils.LOG_INFO("[Old Feature - Circuits] Failed removing circuit assembler recipe map."); + return false; + } + return true; + } + +} diff --git a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java index 372527cdb2..16599b3b8b 100644 --- a/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/BlockEventHandler.java @@ -1,7 +1,7 @@ package gtPlusPlus.core.handler.events; -import static gtPlusPlus.core.lib.CORE.configSwitches.chanceToDropDrainedShard; -import static gtPlusPlus.core.lib.CORE.configSwitches.chanceToDropFluoriteOre; +import static gtPlusPlus.core.lib.CORE.ConfigSwitches.chanceToDropDrainedShard; +import static gtPlusPlus.core.lib.CORE.ConfigSwitches.chanceToDropFluoriteOre; import java.util.ArrayList; import java.util.Random; diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java index eac8757b0e..1096816690 100644 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java @@ -39,7 +39,7 @@ public class LoginEventHandler { if (!this.localPlayerRef.worldObj.isRemote){ PlayerCache.appendParamChanges(this.localPlayersName, this.localPlayersUUID.toString()); - if (CORE.configSwitches.enableUpdateChecker){ + if (CORE.ConfigSwitches.enableUpdateChecker){ if (!Utils.isModUpToDate()){ Utils.LOG_INFO("[GT++] You're not using the latest recommended version of GT++, consider updating."); if (!CORE.MASTER_VERSION.toLowerCase().equals("offline")) { |