package com.hbm.config; import com.google.gson.Gson; import com.hbm.util.Compat; import java.io.File; import java.util.HashMap; // https://youtube.com/shorts/XTHZWqZt_AI public class ClientConfig extends RunningConfig { public static final Gson gson = new Gson(); public static HashMap configMap = new HashMap(); //separate fields because they are a tad faster than using a hashmap and also because using them is less verbose public static ConfigWrapper GEIGER_OFFSET_HORIZONTAL = new ConfigWrapper(0); public static ConfigWrapper GEIGER_OFFSET_VERTICAL = new ConfigWrapper(0); public static ConfigWrapper INFO_OFFSET_HORIZONTAL = new ConfigWrapper(0); public static ConfigWrapper INFO_OFFSET_VERTICAL = new ConfigWrapper(0); public static ConfigWrapper INFO_POSITION = new ConfigWrapper(0); public static ConfigWrapper GUN_ANIMS_LEGACY = new ConfigWrapper(false); public static ConfigWrapper GUN_MODEL_FOV = new ConfigWrapper(false); public static ConfigWrapper GUN_VISUAL_RECOIL = new ConfigWrapper(true); public static ConfigWrapper GUN_ANIMATION_SPEED = new ConfigWrapper(1D); public static ConfigWrapper ITEM_TOOLTIP_SHOW_OREDICT = new ConfigWrapper(true); public static ConfigWrapper ITEM_TOOLTIP_SHOW_CUSTOM_NUKE = new ConfigWrapper(true); public static ConfigWrapper MAIN_MENU_WACKY_SPLASHES = new ConfigWrapper(true); public static ConfigWrapper DODD_RBMK_DIAGNOSTIC = new ConfigWrapper(true); public static ConfigWrapper RENDER_CABLE_HANG = new ConfigWrapper(true); public static ConfigWrapper NUKE_HUD_FLASH = new ConfigWrapper(true); public static ConfigWrapper NUKE_HUD_SHAKE = new ConfigWrapper(true); public static ConfigWrapper RENDER_REEDS = new ConfigWrapper(!Compat.isModLoaded(Compat.MOD_ANG)); public static ConfigWrapper NEI_HIDE_SECRETS = new ConfigWrapper(true); public static ConfigWrapper COOLING_TOWER_PARTICLES = new ConfigWrapper(true); public static ConfigWrapper RENDER_REBAR_SIMPLE = new ConfigWrapper(false); public static ConfigWrapper RENDER_HELIOSTAT_BEAM_LIMIT = new ConfigWrapper(250); public static ConfigWrapper RENDER_REBAR_LIMIT = new ConfigWrapper(250); public static ConfigWrapper TOOL_HUD_INDICATOR_X = new ConfigWrapper(0); public static ConfigWrapper TOOL_HUD_INDICATOR_Y = new ConfigWrapper(0); private static void initDefaults() { configMap.put("GEIGER_OFFSET_HORIZONTAL", GEIGER_OFFSET_HORIZONTAL); configMap.put("GEIGER_OFFSET_VERTICAL", GEIGER_OFFSET_VERTICAL); configMap.put("INFO_OFFSET_HORIZONTAL", INFO_OFFSET_HORIZONTAL); configMap.put("INFO_OFFSET_VERTICAL", INFO_OFFSET_VERTICAL); configMap.put("INFO_POSITION", INFO_POSITION); configMap.put("GUN_ANIMS_LEGACY", GUN_ANIMS_LEGACY); configMap.put("GUN_MODEL_FOV", GUN_MODEL_FOV); configMap.put("GUN_VISUAL_RECOIL", GUN_VISUAL_RECOIL); configMap.put("GUN_ANIMATION_SPEED", GUN_ANIMATION_SPEED); configMap.put("ITEM_TOOLTIP_SHOW_OREDICT", ITEM_TOOLTIP_SHOW_OREDICT); configMap.put("ITEM_TOOLTIP_SHOW_CUSTOM_NUKE", ITEM_TOOLTIP_SHOW_CUSTOM_NUKE); configMap.put("MAIN_MENU_WACKY_SPLASHES", MAIN_MENU_WACKY_SPLASHES); configMap.put("DODD_RBMK_DIAGNOSTIC", DODD_RBMK_DIAGNOSTIC); configMap.put("RENDER_CABLE_HANG", RENDER_CABLE_HANG); configMap.put("NUKE_HUD_FLASH", NUKE_HUD_FLASH); configMap.put("NUKE_HUD_SHAKE", NUKE_HUD_SHAKE); configMap.put("RENDER_REEDS", RENDER_REEDS); configMap.put("NEI_HIDE_SECRETS", NEI_HIDE_SECRETS); configMap.put("COOLING_TOWER_PARTICLES", COOLING_TOWER_PARTICLES); configMap.put("RENDER_REBAR_SIMPLE", RENDER_REBAR_SIMPLE); configMap.put("RENDER_HELIOSTAT_BEAM_LIMIT", RENDER_HELIOSTAT_BEAM_LIMIT); configMap.put("RENDER_REBAR_LIMIT", RENDER_REBAR_LIMIT); configMap.put("TOOL_HUD_INDICATOR_X", TOOL_HUD_INDICATOR_X); configMap.put("TOOL_HUD_INDICATOR_Y", TOOL_HUD_INDICATOR_Y); } /** Initializes defaults, then reads the config file if it exists, then writes the config file. */ public static void initConfig() { initDefaults(); 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 config = getConfig("hbmClient.json"); writeConfig(config); } /** Writes over the running config using the config file. */ public static void reload() { File config = getConfig("hbmClient.json"); if(config.exists()) readConfig(config); } private static void readConfig(File config) { RunningConfig.readConfig(config, configMap); } private static void writeConfig(File config) { RunningConfig.writeConfig(config, configMap, "This file can be edited ingame using the /ntmclient command."); } }