Vaern 5f4c6469c4 Organized structure classes, added config for structures and loot within
tomorrow we got the epic looking computer deco block coming in it's freaking amazing gamers see you on the battlebus
2022-09-11 14:23:05 -07:00

82 lines
3.2 KiB
Java

package com.hbm.config;
import com.hbm.main.MainRegistry;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
public class CommonConfig {
public static final String CATEGORY_GENERAL = "01_general";
public static final String CATEGORY_ORES = "02_ores";
public static final String CATEGORY_NUKES = "03_nukes";
public static final String CATEGORY_DUNGEONS = "04_dungeons";
public static final String CATEGORY_METEORS = "05_meteors";
public static final String CATEGORY_EXPLOSIONS = "06_explosions";
public static final String CATEGORY_MISSILE = "07_missile_machines";
public static final String CATEGORY_POTION = "08_potion_effects";
public static final String CATEGORY_MACHINES = "09_machines";
public static final String CATEGORY_DROPS = "10_dangerous_drops";
public static final String CATEGORY_TOOLS = "11_tools";
public static final String CATEGORY_MOBS = "12_mobs";
public static final String CATEGORY_RADIATION = "13_radiation";
public static final String CATEGORY_HAZARD = "14_hazard";
public static final String CATEGORY_STRUCTURES = "15_structures";
public static final String CATEGORY_528 = "528";
public static final String CATEGORY_LBSM = "LESS BULLSHIT MODE";
public static int setDefZero(int value, int def) {
if(value < 0) {
MainRegistry.logger.error("Fatal error config: Randomizer value has been below zero, despite bound having to be positive integer!");
MainRegistry.logger.error(String.format("Errored value will default back to %d, PLEASE REVIEW CONFIGURATION DESCRIPTION BEFORE MEDDLING WITH VALUES!", def));
return def;
}
return value;
}
public static int setDef(int value, int def) {
if(value <= 0) {
MainRegistry.logger.error("Fatal error config: Randomizer value has been set to zero, despite bound having to be positive integer!");
MainRegistry.logger.error(String.format("Errored value will default back to %d, PLEASE REVIEW CONFIGURATION DESCRIPTION BEFORE MEDDLING WITH VALUES!", def));
return def;
}
return value;
}
public static int createConfigInt(Configuration config, String category, String name, String comment, int def) {
Property prop = config.get(category, name, def);
prop.comment = comment;
return prop.getInt();
}
public static double createConfigDouble(Configuration config, String category, String name, String comment, double def) {
Property prop = config.get(category, name, def);
prop.comment = comment;
return prop.getDouble();
}
public static boolean createConfigBool(Configuration config, String category, String name, String comment, boolean def) {
Property prop = config.get(category, name, def);
prop.comment = comment;
return prop.getBoolean();
}
public static String createConfigString(Configuration config, String category, String name, String comment, String def) {
Property prop = config.get(category, name, def);
prop.comment = comment;
return prop.getString();
}
public static String[] createConfigStringList(Configuration config, String category, String name, String comment) {
Property prop = config.get(category, name, new String[] { "PLACEHOLDER" });
prop.comment = comment;
return prop.getStringList();
}
}