config crap

This commit is contained in:
Boblet 2025-03-05 16:57:50 +01:00
parent ed4421b2e2
commit e21fe3eecc
12 changed files with 56 additions and 52 deletions

View File

@ -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

View File

@ -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
@ -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

View File

@ -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();
@ -56,23 +54,20 @@ public class ClientConfig {
/** 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);
}

View File

@ -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;
@ -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;
@ -100,15 +97,12 @@ public class GeneralConfig {
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);

View File

@ -14,10 +14,16 @@ import com.google.gson.Gson;
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) {

View File

@ -4,7 +4,6 @@ import java.io.File;
import java.util.HashMap;
import com.google.gson.Gson;
import com.hbm.main.MainRegistry;
public class ServerConfig extends RunningConfig {
@ -16,6 +15,7 @@ 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);
@ -23,28 +23,26 @@ public class ServerConfig extends RunningConfig {
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);
}

View File

@ -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;
@ -57,7 +57,7 @@ public class EntityCreeperTainted extends EntityCreeper implements IRadiationImm
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);
@ -73,7 +73,7 @@ public class EntityCreeperTainted extends EntityCreeper implements IRadiationImm
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);

View File

@ -33,7 +33,7 @@ import net.minecraft.item.Item;
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();
@ -141,7 +141,7 @@ public abstract class SerializableRecipe {
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() { }

View File

@ -5,6 +5,7 @@ import java.util.List;
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;
@ -169,6 +170,8 @@ public class ItemGunBaseNT extends Item implements IKeybindReceiver, IEquipRecei
}
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++) {

View File

@ -1175,30 +1175,34 @@ public class CraftingManager {
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());
}
}
}
}

View File

@ -3,8 +3,8 @@ package com.hbm.potion;
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;
@ -107,7 +107,7 @@ public class HbmPotion extends Potion {
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);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 354 B