Skip to content

Commit

Permalink
config crap
Browse files Browse the repository at this point in the history
  • Loading branch information
HbmMods committed Mar 5, 2025
1 parent ed4421b commit e21fe3e
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 52 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

* NTM Reloaded: https://github.com/TheOriginalGolem/Hbm-s-Nuclear-Tech-GIT/releases
* NTM Extended Edition (Alcater): https://github.com/Alcatergit/Hbm-s-Nuclear-Tech-GIT/releases
* NTM WarFactory: https://github.com/MisterNorwood/Hbm-s-Nuclear-Tech-GIT/releases

For 1.18, try Martin's remake: https://codeberg.org/MartinTheDragon/Nuclear-Tech-Mod-Remake/releases

Expand Down
5 changes: 4 additions & 1 deletion changelog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Functions like `/ntmclient` but for common settings
* Can toggle `DAMAGE_COMPATIBILITY_MODE`, off by default, enables a more compatible (but slightly jankier) version of the bullet damage code
* `MINE_<xxx>_DAMAGE` can be used to adjust landmine damage
* `TAINT_TRAILS` now replaces the hardcore taint config option, making taint blocks more potent and the potion effect trail taint blocks

## Changed
* Fat mines now use the standardized mini nuke code
Expand All @@ -17,8 +18,10 @@
* Taint has a 25% chance of splashing down when replacing a block with no supports, causing structures to collapse and taint to spread faster
* Similar to soil sand, entities will sink in taint and get slowed down
* The sludge consumeth
* `enableGuns` config option now applies to SEDNA system guns, simply canceling all gun-related keybinds

## Fixed
* Fixed animation error on the MAS-36
* Fixed drone docks, requester and provider crates not dropping their contents when broken
* Fixed all missing texture errors that appear in the startup log
* Fixed all missing texture errors that appear in the startup log
* Potentially fixed a crash with mekanism during the recipe change phase
13 changes: 4 additions & 9 deletions src/main/java/com/hbm/config/ClientConfig.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package com.hbm.config;

import com.google.gson.Gson;
import com.hbm.config.RunningConfig.ConfigWrapper;
import com.hbm.main.MainRegistry;
import com.hbm.util.Compat;

import java.io.File;
import java.util.HashMap;

// https://youtube.com/shorts/XTHZWqZt_AI
public class ClientConfig {
public class ClientConfig extends RunningConfig {

public static final Gson gson = new Gson();
public static HashMap<String, ConfigWrapper> configMap = new HashMap();
Expand Down Expand Up @@ -56,23 +54,20 @@ private static void initDefaults() {
/** Initializes defaults, then reads the config file if it exists, then writes the config file. */
public static void initConfig() {
initDefaults();
File folder = MainRegistry.configHbmDir;
File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmClient.json");
File config = getConfig("hbmClient.json");
if(config.exists()) readConfig(config);
refresh();
}

/** Writes over the config file using the running config. */
public static void refresh() {
File folder = MainRegistry.configHbmDir;
File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmClient.json");
File config = getConfig("hbmClient.json");
writeConfig(config);
}

/** Writes over the running config using the config file. */
public static void reload() {
File folder = MainRegistry.configHbmDir;
File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmClient.json");
File config = getConfig("hbmClient.json");
if(config.exists()) readConfig(config);
}

Expand Down
6 changes: 0 additions & 6 deletions src/main/java/com/hbm/config/GeneralConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ public class GeneralConfig {
public static boolean enableVaults = true;
public static boolean enableCataclysm = false;
public static boolean enableExtendedLogging = false;
public static boolean enableHardcoreTaint = false;
public static boolean enableGuns = true;
public static boolean enableVirus = true;
public static boolean enableCrosshairs = true;
public static boolean enableReflectorCompat = false;
public static boolean enableRenderDistCheck = true;
public static boolean enableReEval = true;
public static boolean enableSilentCompStackErrors = true;
public static boolean enableSkyboxes = true;
public static boolean enableImpactWorldProvider = true;
Expand All @@ -42,7 +40,6 @@ public class GeneralConfig {
public static boolean enableSoundExtension = true;
public static boolean enableMekanismChanges = true;
public static int normalSoundChannels = 200;
public static int hintPos = 0;

public static boolean enableExpensiveMode = false;

Expand Down Expand Up @@ -100,15 +97,12 @@ public static void loadFromConfig(Configuration config) {
enableVaults = config.get(CATEGORY_GENERAL, "1.15_enableVaultSpawn", true, "Allows locked safes to spawn").getBoolean(true);
enableCataclysm = config.get(CATEGORY_GENERAL, "1.17_enableCataclysm", false, "Causes satellites to fall whenever a mob dies").getBoolean(false);
enableExtendedLogging = config.get(CATEGORY_GENERAL, "1.18_enableExtendedLogging", false, "Logs uses of the detonator, nuclear explosions, missile launches, grenades, etc.").getBoolean(false);
enableHardcoreTaint = config.get(CATEGORY_GENERAL, "1.19_enableHardcoreTaint", false, "Allows tainted mobs to spread taint").getBoolean(false);
enableGuns = config.get(CATEGORY_GENERAL, "1.20_enableGuns", true, "Prevents new system guns to be fired").getBoolean(true);
enableVirus = config.get(CATEGORY_GENERAL, "1.21_enableVirus", false, "Allows virus blocks to spread").getBoolean(false);
enableCrosshairs = config.get(CATEGORY_GENERAL, "1.22_enableCrosshairs", true, "Shows custom crosshairs when an NTM gun is being held").getBoolean(true);
enableReflectorCompat = config.get(CATEGORY_GENERAL, "1.24_enableReflectorCompat", false, "Enable old reflector oredict name (\"plateDenseLead\") instead of new \"plateTungCar\"").getBoolean(false);
enableRenderDistCheck = config.get(CATEGORY_GENERAL, "1.25_enableRenderDistCheck", true, "Check invalid render distances (over 16, without OptiFine) and fix it").getBoolean(true);
enableReEval = config.get(CATEGORY_GENERAL, "1.27_enableReEval", true, "Allows re-evaluating power networks on link remove instead of destroying and recreating").getBoolean(true);
enableSilentCompStackErrors = config.get(CATEGORY_GENERAL, "1.28_enableSilentCompStackErrors", false, "Enabling this will disable log spam created by unregistered items in ComparableStack instances.").getBoolean(false);
hintPos = CommonConfig.createConfigInt(config, CATEGORY_GENERAL, "1.29_hudOverlayPosition", "0: Top left\n1: Top right\n2: Center right\n3: Center Left", 0);
enableSkyboxes = config.get(CATEGORY_GENERAL, "1.31_enableSkyboxes", true, "If enabled, will try to use NTM's custom skyboxes.").getBoolean(true);
enableImpactWorldProvider = config.get(CATEGORY_GENERAL, "1.32_enableImpactWorldProvider", true, "If enabled, registers custom world provider which modifies lighting and sky colors for post impact effects.").getBoolean(true);
enableStatReRegistering = config.get(CATEGORY_GENERAL, "1.33_enableStatReRegistering", true, "If enabled, will re-register item crafting/breaking/usage stats in order to fix a forge bug where modded items just won't show up.").getBoolean(true);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/hbm/config/RunningConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.stream.JsonWriter;
import com.hbm.main.MainRegistry;

public class RunningConfig {

public static final Gson gson = new Gson();

public static File getConfig(String name) {
File folder = MainRegistry.configHbmDir;
return new File(folder.getAbsolutePath() + File.separatorChar + name);
}

public static void readConfig(File config, HashMap<String, ConfigWrapper> configMap) {

Expand Down
12 changes: 5 additions & 7 deletions src/main/java/com/hbm/config/ServerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.HashMap;

import com.google.gson.Gson;
import com.hbm.main.MainRegistry;

public class ServerConfig extends RunningConfig {

Expand All @@ -16,35 +15,34 @@ public class ServerConfig extends RunningConfig {
public static ConfigWrapper<Float> MINE_HE_DAMAGE = new ConfigWrapper(35F);
public static ConfigWrapper<Float> MINE_SHRAP_DAMAGE = new ConfigWrapper(7.5F);
public static ConfigWrapper<Float> MINE_NUKE_DAMAGE = new ConfigWrapper(100F);
public static ConfigWrapper<Boolean> TAINT_TRAILS = new ConfigWrapper(false);

private static void initDefaults() {
configMap.put("DAMAGE_COMPATIBILITY_MODE", DAMAGE_COMPATIBILITY_MODE);
configMap.put("MINE_AP_DAMAGE", MINE_AP_DAMAGE);
configMap.put("MINE_HE_DAMAGE", MINE_HE_DAMAGE);
configMap.put("MINE_SHRAP_DAMAGE", MINE_SHRAP_DAMAGE);
configMap.put("MINE_NUKE_DAMAGE", MINE_NUKE_DAMAGE);
configMap.put("TAINT_TRAILS", TAINT_TRAILS);
}

/** Initializes defaults, then reads the config file if it exists, then writes the config file. */
public static void initConfig() {
initDefaults();
File folder = MainRegistry.configHbmDir;
File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmServer.json");
File config = getConfig("hbmServer.json");
if(config.exists()) readConfig(config);
refresh();
}

/** Writes over the config file using the running config. */
public static void refresh() {
File folder = MainRegistry.configHbmDir;
File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmServer.json");
File config = getConfig("hbmServer.json");
writeConfig(config);
}

/** Writes over the running config using the config file. */
public static void reload() {
File folder = MainRegistry.configHbmDir;
File config = new File(folder.getAbsolutePath() + File.separatorChar + "hbmServer.json");
File config = getConfig("hbmServer.json");
if(config.exists()) readConfig(config);
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/hbm/entity/mob/EntityCreeperTainted.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hbm.entity.mob;

import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig;
import com.hbm.config.ServerConfig;

import api.hbm.entity.IRadiationImmune;
import net.minecraft.block.Block;
Expand Down Expand Up @@ -57,7 +57,7 @@ public void func_146077_cc() {
int c = rand.nextInt(15) + (int) posZ - 7;
Block block = worldObj.getBlock(a, b, c);
if(block.isNormalCube() && !block.isAir(worldObj, a, b, c)) {
if(!GeneralConfig.enableHardcoreTaint) {
if(!ServerConfig.TAINT_TRAILS.get()) {
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3) + 5, 2);
} else {
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3), 2);
Expand All @@ -73,7 +73,7 @@ public void func_146077_cc() {
int c = rand.nextInt(7) + (int) posZ - 3;
Block block = worldObj.getBlock(a, b, c);
if(block.isNormalCube() && !block.isAir(worldObj, a, b, c)) {
if(!GeneralConfig.enableHardcoreTaint) {
if(!ServerConfig.TAINT_TRAILS.get()) {
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(6) + 10, 2);
} else {
worldObj.setBlock(a, b, c, ModBlocks.taint, rand.nextInt(3) + 4, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import net.minecraft.item.ItemStack;

//the anti-spaghetti. this class provides so much functionality and saves so much time, i just love you, SerializableRecipe <3
public abstract class SerializableRecipe {
public abstract class SerializableRecipe { //TODO: #1969

public static final Gson gson = new Gson();
public static List<SerializableRecipe> recipeHandlers = new ArrayList();
Expand Down Expand Up @@ -141,7 +141,7 @@ public static void initialize() {
public abstract void writeRecipe(Object recipe, JsonWriter writer) throws IOException;
/** Registers the default recipes */
public abstract void registerDefaults();
/** Deletes all existing recipes, currenly unused */
/** Deletes all existing recipes, currently unused */
public abstract void deleteRecipes();
/** A routine called after registering all recipes, whether it's a template or not. Good for IMC functionality. */
public void registerPost() { }
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/hbm/items/weapon/sedna/ItemGunBaseNT.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiConsumer;

import com.hbm.config.GeneralConfig;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.interfaces.IItemHUD;
import com.hbm.items.IEquipReceiver;
Expand Down Expand Up @@ -169,6 +170,8 @@ public void handleKeybind(EntityPlayer player, ItemStack stack, EnumKeybind keyb
}

public void handleKeybind(EntityLivingBase entity, IInventory inventory, ItemStack stack, EnumKeybind keybind, boolean newState) {
if(!GeneralConfig.enableGuns) return;

int configs = this.configs_DNA.length;

for(int i = 0; i < configs; i++) {
Expand Down
48 changes: 26 additions & 22 deletions src/main/java/com/hbm/main/CraftingManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1175,30 +1175,34 @@ public static void crumple() {

List<IRecipe> toDestroy = new ArrayList();

for(Object o : net.minecraft.item.crafting.CraftingManager.getInstance().getRecipeList()) {

if(o instanceof IRecipe) {
IRecipe rec = (IRecipe)o;
ItemStack stack = rec.getRecipeOutput();

for(ItemStack target : targets) {
if(stack != null && stack.getItem() == target.getItem() && stack.getItemDamage() == target.getItemDamage()) toDestroy.add(rec);
List recipeList = net.minecraft.item.crafting.CraftingManager.getInstance().getRecipeList();

synchronized(recipeList) { //this is how threading works. i think.
for(Object o : recipeList) {

if(o instanceof IRecipe) {
IRecipe rec = (IRecipe)o;
ItemStack stack = rec.getRecipeOutput();

for(ItemStack target : targets) {
if(stack != null && stack.getItem() == target.getItem() && stack.getItemDamage() == target.getItemDamage()) toDestroy.add(rec);
}
}
}
}

if(toDestroy.size() > 0) {
net.minecraft.item.crafting.CraftingManager.getInstance().getRecipeList().removeAll(toDestroy);
}

if(Loader.isModLoaded("Mekanism")) {
Item disassembler = (Item) Item.itemRegistry.getObject("Mekanism:AtomicDisassembler");
if(disassembler != null) addRecipeAuto(new ItemStack(disassembler, 1), "GAG", "EIE", " I ", 'G', GOLD.plateCast(), 'A', "alloyUltimate", 'E', "battery", 'I', "ingotRefinedObsidian");
}

if(Loader.isModLoaded("MekanismGenerators")) {
Block generator = (Block) Block.blockRegistry.getObject("MekanismGenerators:Generator");
if(generator != null) addRecipeAuto(new ItemStack(generator, 1, 6), " T ", "TAT", "BCB", 'T', TI.plateCast(), 'A', "alloyAdvanced", 'B', "battery", 'C', ANY_PLASTIC.ingot());

if(toDestroy.size() > 0) {
recipeList.removeAll(toDestroy);
}

if(Loader.isModLoaded("Mekanism")) {
Item disassembler = (Item) Item.itemRegistry.getObject("Mekanism:AtomicDisassembler");
if(disassembler != null) addRecipeAuto(new ItemStack(disassembler, 1), "GAG", "EIE", " I ", 'G', GOLD.plateCast(), 'A', "alloyUltimate", 'E', "battery", 'I', "ingotRefinedObsidian");
}

if(Loader.isModLoaded("MekanismGenerators")) {
Block generator = (Block) Block.blockRegistry.getObject("MekanismGenerators:Generator");
if(generator != null) addRecipeAuto(new ItemStack(generator, 1, 6), " T ", "TAT", "BCB", 'T', TI.plateCast(), 'A', "alloyAdvanced", 'B', "battery", 'C', ANY_PLASTIC.ingot());
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/hbm/potion/HbmPotion.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import java.lang.reflect.Field;

import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig;
import com.hbm.config.PotionConfig;
import com.hbm.config.ServerConfig;
import com.hbm.entity.mob.EntityTaintCrab;
import com.hbm.entity.mob.EntityCreeperTainted;
import com.hbm.explosion.ExplosionLarge;
Expand Down Expand Up @@ -107,7 +107,7 @@ public void performEffect(EntityLivingBase entity, int level) {
if(!(entity instanceof EntityCreeperTainted) && !(entity instanceof EntityTaintCrab) && entity.worldObj.rand.nextInt(40) == 0)
entity.attackEntityFrom(ModDamageSource.taint, (level + 1));

if(GeneralConfig.enableHardcoreTaint && !entity.worldObj.isRemote) {
if(ServerConfig.TAINT_TRAILS.get() && !entity.worldObj.isRemote) {

int x = (int) Math.floor(entity.posX);
int y = (int) Math.floor(entity.posY);
Expand Down
Binary file modified src/main/resources/assets/hbm/textures/items/syringe_taint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e21fe3e

Please sign in to comment.