aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/tectech/loader
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/tectech/loader')
-rw-r--r--src/main/java/tectech/loader/ConfigHandler.java61
-rw-r--r--src/main/java/tectech/loader/MainLoader.java112
-rw-r--r--src/main/java/tectech/loader/TecTechConfig.java257
-rw-r--r--src/main/java/tectech/loader/gui/TecTechGUIClientConfig.java17
-rw-r--r--src/main/java/tectech/loader/gui/TecTechGUIFactory.java13
5 files changed, 92 insertions, 368 deletions
diff --git a/src/main/java/tectech/loader/ConfigHandler.java b/src/main/java/tectech/loader/ConfigHandler.java
new file mode 100644
index 0000000000..e360b5f671
--- /dev/null
+++ b/src/main/java/tectech/loader/ConfigHandler.java
@@ -0,0 +1,61 @@
+package tectech.loader;
+
+import com.gtnewhorizon.gtnhlib.config.Config;
+
+import gregtech.api.enums.Mods;
+
+@Config(modid = Mods.Names.TECTECH, filename = "tectech")
+@Config.LangKeyPattern(pattern = "GT5U.gui.config.%cat.%field", fullyQualified = true)
+@Config.RequiresMcRestart
+public class ConfigHandler {
+
+ public static Debug debug = new Debug();
+ public static TeslaTweaks teslaTweaks = new TeslaTweaks();
+
+ @Config.Comment("Debug section")
+ public static class Debug {
+
+ @Config.Comment("Enables logging and other purely debug features")
+ @Config.DefaultBoolean(false)
+ public boolean DEBUG_MODE;
+ }
+
+ @Config.Comment("Tesla tweaks section")
+ public static class TeslaTweaks {
+
+ @Config.Ignore()
+ public static final float TESLA_MULTI_LOSS_FACTOR_OVERDRIVE = 0.25f;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_LOSS_PER_BLOCK_T0 = 1;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_LOSS_PER_BLOCK_T1 = 1;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_LOSS_PER_BLOCK_T2 = 1;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM = 100;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN = 50;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON = 50;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1 = 2;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2 = 4;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_RANGE_COVER = 16;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_RANGE_TOWER = 32;
+ @Config.Ignore()
+ public static final int TESLA_MULTI_RANGE_TRANSCEIVER = 16;
+ @Config.Ignore()
+ public static final float TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE = 0.25f;
+ @Config.Ignore()
+ public static final int TESLA_SINGLE_LOSS_PER_BLOCK = 1;
+
+ @Config.Ignore()
+ public static final int TESLA_SINGLE_RANGE = 20;
+ @Config.Comment("Set true to enable the cool visual effect when tesla tower running.")
+ @Config.DefaultBoolean(true)
+ public boolean TESLA_VISUAL_EFFECT;
+ }
+}
diff --git a/src/main/java/tectech/loader/MainLoader.java b/src/main/java/tectech/loader/MainLoader.java
index 801653ca4b..ab687fbbf9 100644
--- a/src/main/java/tectech/loader/MainLoader.java
+++ b/src/main/java/tectech/loader/MainLoader.java
@@ -1,26 +1,14 @@
package tectech.loader;
import static gregtech.api.enums.Mods.NewHorizonsCoreMod;
-import static gregtech.api.enums.Mods.TwilightForest;
import static tectech.TecTech.LOGGER;
-import static tectech.TecTech.configTecTech;
import static tectech.TecTech.creativeTabTecTech;
import static tectech.TecTech.proxy;
-import static tectech.loader.TecTechConfig.DEBUG_MODE;
-
-import java.util.HashMap;
import net.minecraft.block.Block;
import net.minecraft.util.DamageSource;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
import cpw.mods.fml.common.ProgressManager;
-import cpw.mods.fml.common.registry.GameRegistry;
-import gregtech.api.GregTechAPI;
-import gregtech.api.enums.Materials;
-import gregtech.api.recipe.RecipeMaps;
-import gregtech.api.util.GTRecipe;
import tectech.TecTech;
import tectech.loader.gui.CreativeTabTecTech;
import tectech.loader.recipe.BaseRecipeLoader;
@@ -80,7 +68,7 @@ public final class MainLoader {
}
public static void postLoad() {
- ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 4);
+ ProgressManager.ProgressBar progressBarPostLoad = ProgressManager.push("TecTech Post Loader", 2);
progressBarPostLoad.step("Dreamcraft Compatibility");
if (NewHorizonsCoreMod.isModLoaded()) {
@@ -100,104 +88,6 @@ public final class MainLoader {
progressBarPostLoad.step("Recipes");
new BaseRecipeLoader().run();
TecTech.LOGGER.info("Recipe Init Done");
-
- if (!configTecTech.DISABLE_BLOCK_HARDNESS_NERF) {
- progressBarPostLoad.step("Nerf blocks blast resistance");
- adjustTwilightBlockResistance();
- TecTech.LOGGER.info("Blocks nerf done");
- } else {
- progressBarPostLoad.step("Do not nerf blocks blast resistance");
- TecTech.LOGGER.info("Blocks were not nerfed");
- }
-
- // ProgressManager.pop(progressBarPostLoad);
- }
-
- public static void addAfterGregTechPostLoadRunner() {
- GregTechAPI.sAfterGTPostload.add(() -> {
- if (TecTech.configTecTech.NERF_FUSION) {
- FixBrokenFusionRecipes();
- }
- });
- }
-
- private static void FixBrokenFusionRecipes() {
- HashMap<Fluid, Fluid> binds = new HashMap<>();
- for (Materials material : Materials.values()) {
- FluidStack p = material.getPlasma(1);
- if (p != null) {
- if (DEBUG_MODE) {
- LOGGER.info("Found Plasma of " + material.mName);
- }
- if (material.mElement != null && (material.mElement.mProtons >= Materials.Iron.mElement.mProtons
- || -material.mElement.mProtons >= Materials.Iron.mElement.mProtons
- || material.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons
- || -material.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons)) {
- if (DEBUG_MODE) {
- LOGGER.info("Attempting to bind " + material.mName);
- }
- if (material.getMolten(1) != null) {
- binds.put(
- p.getFluid(),
- material.getMolten(1)
- .getFluid());
- } else if (material.getGas(1) != null) {
- binds.put(
- p.getFluid(),
- material.getGas(1)
- .getFluid());
- } else if (material.getFluid(1) != null) {
- binds.put(
- p.getFluid(),
- material.getFluid(1)
- .getFluid());
- } else {
- binds.put(
- p.getFluid(),
- Materials.Iron.getMolten(1)
- .getFluid());
- }
- }
- }
- }
- for (GTRecipe r : RecipeMaps.fusionRecipes.getAllRecipes()) {
- Fluid fluid = binds.get(r.mFluidOutputs[0].getFluid());
- if (fluid != null) {
- if (DEBUG_MODE) {
- LOGGER.info("Nerfing Recipe " + r.mFluidOutputs[0].getUnlocalizedName());
- }
- r.mFluidOutputs[0] = new FluidStack(fluid, r.mFluidOutputs[0].amount);
- }
- fluid = binds.get(r.mFluidInputs[0].getFluid());
- if (fluid != null) {
- if (DEBUG_MODE) {
- LOGGER.info("Fixing plasma use in Recipe " + r.mFluidInputs[0].getUnlocalizedName());
- }
- r.mFluidInputs[0] = new FluidStack(fluid, r.mFluidInputs[0].amount);
- }
- fluid = binds.get(r.mFluidInputs[1].getFluid());
- if (fluid != null) {
- if (DEBUG_MODE) {
- LOGGER.info("Fixing plasma use in Recipe " + r.mFluidInputs[1].getUnlocalizedName());
- }
- r.mFluidInputs[1] = new FluidStack(fluid, r.mFluidInputs[1].amount);
- }
- }
- }
-
- private static void safeSetResistance(Block block, float resistance) {
- if (block != null) {
- block.setResistance(resistance);
- }
- }
-
- private static void adjustTwilightBlockResistance() {
- if (TwilightForest.isModLoaded()) {
- safeSetResistance(GameRegistry.findBlock("TwilightForest", "tile.TFShield"), 30);
- safeSetResistance(GameRegistry.findBlock("TwilightForest", "tile.TFThorns"), 10);
- safeSetResistance(GameRegistry.findBlock("TwilightForest", "tile.TFTowerTranslucent"), 30);
- safeSetResistance(GameRegistry.findBlock("TwilightForest", "tile.TFDeadrock"), 5);
- }
}
public static void onLoadCompleted() {
diff --git a/src/main/java/tectech/loader/TecTechConfig.java b/src/main/java/tectech/loader/TecTechConfig.java
deleted file mode 100644
index 9c9425a9c9..0000000000
--- a/src/main/java/tectech/loader/TecTechConfig.java
+++ /dev/null
@@ -1,257 +0,0 @@
-package tectech.loader;
-
-import java.io.File;
-
-import eu.usrv.yamcore.config.ConfigManager;
-
-public class TecTechConfig extends ConfigManager {
-
- public TecTechConfig(File pConfigBaseDirectory, String pModCollectionDirectory, String pModID) {
- super(pConfigBaseDirectory, pModCollectionDirectory, pModID);
- }
-
- // final static to allow compiler to remove the debug code when this is false
- public static boolean DEBUG_MODE = false;
- public static boolean POWERLESS_MODE = false;
- public boolean BOOM_ENABLE;
- public boolean DISABLE_BLOCK_HARDNESS_NERF;
- public boolean EASY_SCAN;
- public boolean NERF_FUSION;
- public boolean ENABLE_TURRET_EXPLOSIONS;
- public float TURRET_DAMAGE_FACTOR;
- public float TURRET_EXPLOSION_FACTOR;
-
- public boolean MOD_ADMIN_ERROR_LOGS;
-
- public boolean TESLA_MULTI_GAS_OUTPUT;
- public float TESLA_MULTI_LOSS_FACTOR_OVERDRIVE;
- public int TESLA_MULTI_LOSS_PER_BLOCK_T0;
- public int TESLA_MULTI_LOSS_PER_BLOCK_T1;
- public int TESLA_MULTI_LOSS_PER_BLOCK_T2;
- public int TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM;
- public int TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN;
- public int TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON;
- public int TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1;
- public int TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2;
- public int TESLA_MULTI_RANGE_COVER;
- public int TESLA_MULTI_RANGE_TOWER;
- public int TESLA_MULTI_RANGE_TRANSCEIVER;
- public float TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE;
- public int TESLA_SINGLE_LOSS_PER_BLOCK;
- public int TESLA_SINGLE_RANGE;
- public boolean TESLA_VISUAL_EFFECT;
-
- /**
- * This loading phases do not correspond to mod loading phases!
- */
- @Override
- protected void PreInit() {
-
- BOOM_ENABLE = true;
- DISABLE_BLOCK_HARDNESS_NERF = false;
- EASY_SCAN = false;
- NERF_FUSION = false;
- ENABLE_TURRET_EXPLOSIONS = true;
- TURRET_DAMAGE_FACTOR = 10;
- TURRET_EXPLOSION_FACTOR = 1;
-
- MOD_ADMIN_ERROR_LOGS = false;
-
- TESLA_MULTI_GAS_OUTPUT = false;
- TESLA_MULTI_LOSS_FACTOR_OVERDRIVE = 0.25F;
- TESLA_MULTI_LOSS_PER_BLOCK_T0 = 1;
- TESLA_MULTI_LOSS_PER_BLOCK_T1 = 1;
- TESLA_MULTI_LOSS_PER_BLOCK_T2 = 1;
- TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM = 100;
- TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN = 50;
- TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON = 50;
- TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1 = 2;
- TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2 = 4;
- TESLA_MULTI_RANGE_COVER = 16;
- TESLA_MULTI_RANGE_TOWER = 32;
- TESLA_MULTI_RANGE_TRANSCEIVER = 16;
- TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE = 0.25F;
- TESLA_SINGLE_LOSS_PER_BLOCK = 1;
- TESLA_SINGLE_RANGE = 20;
- TESLA_VISUAL_EFFECT = true;
- }
-
- /**
- * This loading phases do not correspond to mod loading phases!
- */
- @Override
- protected void Init() {
- DEBUG_MODE = _mainConfig
- .getBoolean("DebugMode", "debug", DEBUG_MODE, "Enables logging and other purely debug features");
- POWERLESS_MODE = _mainConfig
- .getBoolean("PowerlessMode", "debug", POWERLESS_MODE, "Enables 0EU/t multi block machinery");
-
- BOOM_ENABLE = _mainConfig.getBoolean(
- "BoomEnable",
- "features",
- BOOM_ENABLE,
- "Set to false to disable explosions on everything bad that you can do");
- DISABLE_BLOCK_HARDNESS_NERF = _mainConfig.getBoolean(
- "DisableBlockHardnessNerf",
- "features",
- DISABLE_BLOCK_HARDNESS_NERF,
- "Set to true to disable the block hardness nerf");
- EASY_SCAN = _mainConfig.getBoolean(
- "EasyScan",
- "features",
- EASY_SCAN,
- "Enables tricorder to scan EM i/o hatches directly, too CHEEKY");
- NERF_FUSION = _mainConfig.getBoolean(
- "NerfFusion",
- "features",
- NERF_FUSION,
- "Set to true to enable removal of plasmas heavier than Fe and other weird ones");
- ENABLE_TURRET_EXPLOSIONS = _mainConfig.getBoolean(
- "TurretBoomEnable",
- "features",
- ENABLE_TURRET_EXPLOSIONS,
- "Set to false to disable explosions caused by EM turrets");
- TURRET_DAMAGE_FACTOR = _mainConfig.getFloat(
- "TurretDamageFactor",
- "features",
- TURRET_DAMAGE_FACTOR,
- 0,
- Short.MAX_VALUE,
- "Damage is multiplied by this number");
- TURRET_EXPLOSION_FACTOR = _mainConfig.getFloat(
- "TurretExplosionFactor",
- "features",
- TURRET_EXPLOSION_FACTOR,
- 0,
- Short.MAX_VALUE,
- "Explosion strength is multiplied by this number");
-
- MOD_ADMIN_ERROR_LOGS = _mainConfig.getBoolean(
- "AdminErrorLog",
- "modules",
- MOD_ADMIN_ERROR_LOGS,
- "If set to true, every op/admin will receive all errors occurred during the startup phase as in game message on join");
-
- TESLA_MULTI_GAS_OUTPUT = _mainConfig.getBoolean(
- "TeslaMultiGasOutput",
- "tesla_tweaks",
- TESLA_MULTI_GAS_OUTPUT,
- "Set to true to enable outputting plasmas as gasses from the tesla tower with a 1:1 ratio");
- TESLA_MULTI_LOSS_FACTOR_OVERDRIVE = _mainConfig.getFloat(
- "TeslaMultiLossFactorOverdrive",
- "tesla_tweaks",
- TESLA_MULTI_LOSS_FACTOR_OVERDRIVE,
- 0,
- 1,
- "Additional Tesla Tower power loss per amp as a factor of the tier voltage");
- TESLA_MULTI_LOSS_PER_BLOCK_T0 = _mainConfig.getInt(
- "TeslaMultiLossPerBlockT0",
- "tesla_tweaks",
- TESLA_MULTI_LOSS_PER_BLOCK_T0,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower power transmission loss per block per amp using no plasmas");
- TESLA_MULTI_LOSS_PER_BLOCK_T1 = _mainConfig.getInt(
- "TeslaMultiLossPerBlockT1",
- "tesla_tweaks",
- TESLA_MULTI_LOSS_PER_BLOCK_T1,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower power transmission loss per block per amp using helium or nitrogen plasma");
- TESLA_MULTI_LOSS_PER_BLOCK_T2 = _mainConfig.getInt(
- "TeslaMultiLossPerBlockT2",
- "tesla_tweaks",
- TESLA_MULTI_LOSS_PER_BLOCK_T2,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower power transmission loss per block per amp using radon plasma");
- TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM = _mainConfig.getInt(
- "TeslaMultiPlasmaPerSecondT1Helium",
- "tesla_tweaks",
- TESLA_MULTI_PLASMA_PER_SECOND_T1_HELIUM,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower helium plasma consumed each second the tesla tower is active");
- TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN = _mainConfig.getInt(
- "TeslaMultiPlasmaPerSecondT1Nitrogen",
- "tesla_tweaks",
- TESLA_MULTI_PLASMA_PER_SECOND_T1_NITROGEN,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower nitrogen plasma consumed each second the tesla tower is active");
- TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON = _mainConfig.getInt(
- "TeslaMultiPlasmaPerSecondT2Radon",
- "tesla_tweaks",
- TESLA_MULTI_PLASMA_PER_SECOND_T2_RADON,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower radon plasma consumed each second the tesla tower is active");
- TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1 = _mainConfig.getInt(
- "TeslaMultiRangeCoefficientPlasmaT1",
- "tesla_tweaks",
- TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T1,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower T1 Plasmas Range Multiplier");
- TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2 = _mainConfig.getInt(
- "TeslaMultiRangeCoefficientPlasmaT2",
- "tesla_tweaks",
- TESLA_MULTI_RANGE_COEFFICIENT_PLASMA_T2,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower T2 Plasmas Range Multiplier");
- TESLA_MULTI_RANGE_COVER = _mainConfig.getInt(
- "TeslaMultiRangeCover",
- "tesla_tweaks",
- TESLA_MULTI_RANGE_COVER,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower to Tesla Coil Rich Edition Cover max range");
- TESLA_MULTI_RANGE_TOWER = _mainConfig.getInt(
- "TeslaMultiRangeTower",
- "tesla_tweaks",
- TESLA_MULTI_RANGE_TOWER,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower to Tower max range");
- TESLA_MULTI_RANGE_TRANSCEIVER = _mainConfig.getInt(
- "TeslaMultiRangeTransceiver",
- "tesla_tweaks",
- TESLA_MULTI_RANGE_TRANSCEIVER,
- 0,
- Integer.MAX_VALUE,
- "Tesla Tower to Transceiver max range");
- TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE = _mainConfig.getFloat(
- "TeslaSingleLossFactorOverdrive",
- "tesla_tweaks",
- TESLA_SINGLE_LOSS_FACTOR_OVERDRIVE,
- 0,
- 1,
- "Additional Tesla Transceiver power loss per amp as a factor of the tier voltage");
- TESLA_SINGLE_LOSS_PER_BLOCK = _mainConfig.getInt(
- "TeslaSingleLossPerBlock",
- "tesla_tweaks",
- TESLA_SINGLE_LOSS_PER_BLOCK,
- 0,
- Integer.MAX_VALUE,
- "Tesla Transceiver power transmission loss per block per amp");
- TESLA_SINGLE_RANGE = _mainConfig.getInt(
- "TeslaSingleRange",
- "tesla_tweaks",
- TESLA_SINGLE_RANGE,
- 0,
- Integer.MAX_VALUE,
- "Tesla Transceiver to max range");
- TESLA_VISUAL_EFFECT = _mainConfig.getBoolean(
- "EnableTeslaVisualEffect",
- "tesla_tweaks",
- TESLA_VISUAL_EFFECT,
- "Set true to enable the cool visual effect when tesla tower running.");
- }
-
- /**
- * This loading phases do not correspond to mod loading phases!
- */
- @Override
- protected void PostInit() {}
-}
diff --git a/src/main/java/tectech/loader/gui/TecTechGUIClientConfig.java b/src/main/java/tectech/loader/gui/TecTechGUIClientConfig.java
new file mode 100644
index 0000000000..0399c13a59
--- /dev/null
+++ b/src/main/java/tectech/loader/gui/TecTechGUIClientConfig.java
@@ -0,0 +1,17 @@
+package tectech.loader.gui;
+
+import static gregtech.api.enums.Mods.TecTech;
+
+import net.minecraft.client.gui.GuiScreen;
+
+import com.gtnewhorizon.gtnhlib.config.ConfigException;
+import com.gtnewhorizon.gtnhlib.config.SimpleGuiConfig;
+
+import tectech.loader.ConfigHandler;
+
+public class TecTechGUIClientConfig extends SimpleGuiConfig {
+
+ public TecTechGUIClientConfig(GuiScreen parentScreen) throws ConfigException {
+ super(parentScreen, TecTech.ID, "TecTech - Tec Technology!", false, ConfigHandler.class);
+ }
+}
diff --git a/src/main/java/tectech/loader/gui/TecTechGUIFactory.java b/src/main/java/tectech/loader/gui/TecTechGUIFactory.java
new file mode 100644
index 0000000000..f618e77a8c
--- /dev/null
+++ b/src/main/java/tectech/loader/gui/TecTechGUIFactory.java
@@ -0,0 +1,13 @@
+package tectech.loader.gui;
+
+import net.minecraft.client.gui.GuiScreen;
+
+import com.gtnewhorizon.gtnhlib.config.SimpleGuiFactory;
+
+public class TecTechGUIFactory implements SimpleGuiFactory {
+
+ @Override
+ public Class<? extends GuiScreen> mainConfigGuiClass() {
+ return TecTechGUIClientConfig.class;
+ }
+}