下面列出了怎么用net.minecraftforge.common.config.Configuration的API类实例代码及写法,或者点击链接到github查看源代码。
public ConfigManager (File file) {
config = new Configuration(file);
Property propEnableCompostBonemeal = config.get(Configuration.CATEGORY_GENERAL, "enableCompostBonemeal", true);
propEnableCompostBonemeal.comment = "Allows compost trigger plant growth like bonemeal.";
enableCompostBonemeal = propEnableCompostBonemeal.getBoolean();
Property propCompostBonemealStrength = config.get(Configuration.CATEGORY_GENERAL, "compostBonemealStrength", 0.5);
propCompostBonemealStrength.comment = "The probability that compost will succeed when used as bonemeal relative to bonemeal.";
compostBonemealStrength = propCompostBonemealStrength.getDouble();
Property propEnableTilledSoilGrowthBonus = config.get(Configuration.CATEGORY_GENERAL, "enableTilledSoilGrowthBonus", true).setRequiresMcRestart(true);
propEnableTilledSoilGrowthBonus.comment = "Allows tilled garden soil to advance crop growth more quickly. Enables random ticks.";
enableTilledSoilGrowthBonus = propEnableTilledSoilGrowthBonus.getBoolean();
config.save();
}
/**
* Needs to be instantiated somewhere in your mod's loading stage.
*/
public IGWSupportNotifier(){
if(FMLCommonHandler.instance().getSide() == Side.CLIENT && !Loader.isModLoaded("IGWMod")) {
File dir = new File(".", "config");
Configuration config = new Configuration(new File(dir, "IGWMod.cfg"));
config.load();
if(config.get(Configuration.CATEGORY_GENERAL, "enable_missing_notification", true, "When enabled, this will notify players when IGW-Mod is not installed even though mods add support.").getBoolean()) {
ModContainer mc = Loader.instance().activeModContainer();
String modid = mc.getModId();
List<ModContainer> loadedMods = Loader.instance().getActiveModList();
for(ModContainer container : loadedMods) {
if(container.getModId().equals(modid)) {
supportingMod = container.getName();
MinecraftForge.EVENT_BUS.register(this);
ClientCommandHandler.instance.registerCommand(new CommandDownloadIGW());
break;
}
}
}
config.save();
}
}
public BackpacksConfig(File file) {
_config = new Configuration(file);
// Add settings from this class as general category.
addSettingsFromClass(this, Configuration.CATEGORY_GENERAL);
// Iterate over category fields and add their settings.
for (Field field : getClass().getFields()) {
if ((field.getDeclaringClass() != getClass()) ||
!field.getType().getName().endsWith("Category")) continue;
try {
String category = field.getName();
field.set(this, field.getType().getConstructors()[0].newInstance(this));
addSettingsFromClass(field.get(this), category);
if (!_categories.contains(category)) _categories.add(category);
} catch (InstantiationException |
InvocationTargetException |
IllegalAccessException ex) { throw new RuntimeException(ex); }
}
}
public static void loadConfiguration() {
try {
repDisplayPosition = config.getString("Rep Badge Position", Configuration.CATEGORY_CLIENT, "BOTTOM RIGHT", "Location of Rep Badge",
new String[] { "TOP LEFT", "TOP CENTER", "TOP RIGHT", "BOTTOM LEFT", "BOTTOM RIGHT", "OFF" });
repDisplayX = config.getInt("Rep Badge X", Configuration.CATEGORY_CLIENT, 0, -20000, 20000, "Sets X offset of Rep Badge");
repDisplayY = config.getInt("Rep Badge Y", Configuration.CATEGORY_CLIENT, 0, -20000, 20000, "Sets Y offset of Rep Badge");
repDisplayY = config.getInt("Rep Badge Y", Configuration.CATEGORY_CLIENT, 0, -20000, 20000, "Sets Y offset of Rep Badge");
sentrySpawnRate = config.getInt("Sentry Spawn Rate", Configuration.CATEGORY_CLIENT, 3, 0, 5, "Sets Sentry Spawn Rate n + 1");
} catch (Exception e) {
e.printStackTrace();
} finally {
if (config.hasChanged()) {
config.save();
}
}
}
public static void preInit(FMLPreInitializationEvent event) {
// Setup Config.
configDir = event.getSuggestedConfigurationFile().getParentFile().toPath().resolve(Reference.MOD_ID);
config = new Configuration(configDir.resolve("config.cfg").toFile());
// Setup Plant Dir.
jsonDir = configDir.resolve("json");
defaultDir = jsonDir.resolve("defaults");
// Setup Provider
AgriConfigAdapter provider = new ModProvider(config);
MinecraftForge.EVENT_BUS.register(provider);
// Initialize AgriCore
AgriCore.init(new ModLogger(), new ModTranslator(), new ModValidator(), new ModConverter(), provider);
// Transfer Defaults
ResourceHelper.findResources(JSON_FILE_PATTERN.asPredicate()).stream()
.filter(AGRI_FOLDER_PATTERN.asPredicate())
.forEach(r -> ResourceHelper.copyResource(r, configDir.resolve(r), false)
);
// Load the JSON files.
loadJsons();
}
public void preInit(FMLPreInitializationEvent event){
//Read/make the Config file on Startup
File directory = event.getModConfigurationDirectory();
config = new Configuration(new File(directory.getPath(), "LogisticsPipes2.cfg"));
Config.readConfig();
//Load Blocks
BlockRegistry.init();
//Load Pipes
PipeRegistry.init();
//Load Items
ItemRegistry.init();
TileRegistry.init();
LPPacketHandler.registerMessages();
}
/**
* Read the config file ordered by Category
* @throws Exception to Log when sth goes wrong
*/
public static void readConfig(){
Configuration cfg = CommonProxy.config;
try{
cfg.load();
initGeneral(cfg);
initNetwork(cfg);
initWorld(cfg);
}
catch(Exception e){
LogisticsPipes2.logger.log(Level.ERROR, "There was a Problem reading the Config File!");
}
finally{
if(cfg.hasChanged()){
cfg.save();
}
}
}
public OilConfig( Configuration pConfigObject )
{
pConfigObject.addCustomCategoryComment( "ModFixes.OilGen", "The OilgenChance is based on height of the biome. On high-y biomes, the basic chance is divided by 2, on low-y biomes like oceans, it is multiplied by 1.8.\nThe multiplier set here for -OilBoostBiomes- Biomes is applied after those multipliers are set." );
OilFixEnabled = pConfigObject.getBoolean( "GenerateOil", "ModFixes", OilFixEnabled, "Set to true to enable OilSpawn from this Mod. Make sure to disable Oil-Spawn in BuildCraft if you do" );
OilDepostMinDistance = pConfigObject.getInt( "OilDepostMinDistance", "ModFixes.OilGen", OilDepostMinDistance, 0, 1024, "The minimum distance of 2 Oil-Deposits in chunks. Modulo-Based; A 2 here means an deposit can only spawn in chunks that have a number that is a multiple of 2 (Chunknumber * 16 = X/Z coord)" );
OilSphereChance = pConfigObject.getFloat( "OilSphereChance", "ModFixes.OilGen", (float) OilSphereChance, 0.0F, 2000F, "General OilGen factor" );
OilSphereMinRadius = pConfigObject.getInt( "OilSphereMinRadius", "ModFixes.OilGen", OilSphereMinRadius, 0, 20, "The minimum radius of an underground OilSphere" );
OilSphereMaxSize = pConfigObject.getInt( "OilSphereMaxSize", "ModFixes.OilGen", OilSphereMaxSize, 3, 50, "The maximum radius of an underground OilSphere. The final size is calculated by OilSphereMinRadius + Random(OilSphereMaxSize-OilSphereMinRadius)" );
OilDepositThresholdMedium = pConfigObject.getInt( "OilDepositThresholdMedium", "ModFixes.OilGen", OilDepositThresholdMedium, 0, 100, "Threshold at which an oil-deposit will be considered as 'medium' and the fountain will be higher and thicker." );
OilDepositThresholdLarge = pConfigObject.getInt( "OilDepositThresholdLarge", "ModFixes.OilGen", OilDepositThresholdLarge, 0, 100, "Threshold at which an oil-deposit will be considered as 'large' and the fountain will be higher and thicker." );
OilFountainSizeSmall = pConfigObject.getInt( "OilFountainSizeSmall", "ModFixes.OilGen", OilFountainSizeSmall, 0, 100, "Visible height of the fountain above the oil-deposit for MEDIUM deposits" );
OilFountainSizeLarge = pConfigObject.getInt( "OilFountainSizeLarge", "ModFixes.OilGen", OilFountainSizeLarge, 0, 100, "Visible height of the fountain above the oil-deposit for LARGE deposits" );
OilBiomeBoostFactor = pConfigObject.getFloat( "OilBiomeBoostFactor", "ModFixes.OilGen", (float) OilBiomeBoostFactor, 0.0F, 50.0F, "Boost factor of oil spheres in certain Biomes that are listed in -OilBoostBiomes-" );
OilDimensionWhitelist = parseStringListToIntList( pConfigObject.getStringList( "OilDimensionWhitelist", "ModFixes.OilGen", new String[] { "0" }, "List DimensionIDs (Numbers only; One per line!) here where the OilGenerator should do its work" ) );
OilBiomeIDBlackList = parseStringListToIntList( pConfigObject.getStringList( "OilBiomeIDBlackList", "ModFixes.OilGen", new String[] {}, "List BiomeIDs (Numbers only; One per line!) where no oil should be generated" ) );
OilBoostBiomes = parseStringListToIntList( pConfigObject.getStringList( "OilBoostBiomes", "ModFixes.OilGen", new String[] {}, "List BiomeIDs (Numbers only; One per line!) where the boost multiplicator is applied. Leave empty to disable Biome-Boost" ) );
}
public static int getIntFor(Configuration config,String heading, String item, int value, String comment)
{
if (config == null)
return value;
try
{
Property prop = config.get(heading, item, value);
prop.setComment(comment);
return prop.getInt(value);
}
catch (Exception e)
{
System.out.println("[TFC2] Error while trying to add Integer, config wasn't loaded properly!");
}
return value;
}
protected void loadConfig(Configuration config) {
if (this.defaults.fuelCapacity != null) {
this.fuelCapacity = config.get(this.defaults.section.name, "Fuel Capacity", this.defaults.fuelCapacity, "The maximum amount of fuel that this pack can hold.").setMinValue(1).getInt(this.defaults.fuelCapacity);
}
if (this.defaults.fuelUsage != null) {
this.fuelUsage = config.get(this.defaults.section.name, "Fuel Usage", this.defaults.fuelUsage, "The amount of fuel that this pack uses every tick when used.").setMinValue(0).getInt(this.defaults.fuelUsage);
}
if (this.defaults.fuelPerTickIn != null) {
this.fuelPerTickIn = config.get(this.defaults.section.name, "Fuel Per Tick In", this.defaults.fuelPerTickIn, "The amount of fuel that can be inserted into this pack per tick from external sources.").setMinValue(0).getInt(this.defaults.fuelPerTickIn);
}
if (this.defaults.fuelPerTickOut != null) {
this.fuelPerTickOut = config.get(this.defaults.section.name, "Fuel Per Tick Out", this.defaults.fuelPerTickOut, "The amount of fuel that can be extracted from this pack per tick by external sources. Also determines how quickly Flux Packs can charge other items.").setMinValue(0).getInt(this.defaults.fuelPerTickOut);
}
if (this.defaults.armorReduction != null) {
this.armorReduction = config.get(this.defaults.section.name, "Armor Reduction", this.defaults.armorReduction, "How well this pack can protect the user from damage, if armored. The higher the value, the stronger the armor will be.").setMinValue(0).setMaxValue(20).getInt(this.defaults.armorReduction);
}
if (this.defaults.armorFuelPerHit != null) {
this.armorFuelPerHit = config.get(this.defaults.section.name, "Armor Fuel Per Hit", this.defaults.armorFuelPerHit, "How much fuel is lost from this pack when the user is hit, if armored.").setMinValue(0).getInt(this.defaults.armorFuelPerHit);
}
if (this.defaults.enchantability != null) {
this.enchantability = config.get(this.defaults.section.name, "Enchantability", this.defaults.enchantability, "The enchantability of this pack. If set to 0, no enchantments can be applied.").setMinValue(0).getInt(this.defaults.enchantability);
}
}
public ForgeMetrics(final String modName, final String modVersion) throws IOException {
if (modName == null || modVersion == null) {
throw new IllegalArgumentException("modName and modVersion cannot be null");
}
this.modName = modName;
this.modVersion = modVersion;
// load the config
configurationFile = getConfigFile();
configuration = new Configuration(configurationFile);
// Get values, and add some defaults, if needed
configuration.get(Configuration.CATEGORY_GENERAL, "opt-out", false, "Set to true to disable all reporting");
guid = configuration.get(Configuration.CATEGORY_GENERAL, "guid", UUID.randomUUID().toString(), "Server unique ID").getString();
debug = configuration.get(Configuration.CATEGORY_GENERAL, "debug", false, "Set to true for verbose debug").getBoolean(false);
configuration.save();
}
public ForgeMetrics(final String modName, final String modVersion) throws IOException {
if (modName == null || modVersion == null) {
throw new IllegalArgumentException("modName and modVersion cannot be null");
}
this.modName = modName;
this.modVersion = modVersion;
// load the config
configurationFile = getConfigFile();
configuration = new Configuration(configurationFile);
// Get values, and add some defaults, if needed
configuration.get(Configuration.CATEGORY_GENERAL, "opt-out", false, "Set to true to disable all reporting");
guid = configuration.get(Configuration.CATEGORY_GENERAL, "guid", UUID.randomUUID().toString(), "Server unique ID").getString();
debug = configuration.get(Configuration.CATEGORY_GENERAL, "debug", false, "Set to true for verbose debug").getBoolean(false);
configuration.save();
}
public void save() {
// Our settings are very deliberately sorted, so group our settings by
// category and set the property order to how we have ordered the fields.
// This is also why we use LinkedHashMap: Keeps elements in insertion order.
Map<String, List<Setting<?>>> byCategory = getSettings().stream().collect(
Collectors.groupingBy(setting -> setting.getCategory(), LinkedHashMap::new, Collectors.toList()));
for (Map.Entry<String, List<Setting<?>>> entry : byCategory.entrySet()) {
String category = entry.getKey();
if (category.equals(Configuration.CATEGORY_GENERAL)) continue;
List<String> order = entry.getValue().stream().map(Setting::getName).collect(Collectors.toList());
_config.setCategoryPropertyOrder(category, order);
}
// Unfortunately ordering is not possible for categories in the config file itself.
// Remove old config properties.
_config.getCategory(Configuration.CATEGORY_GENERAL).remove("enableHelpTooltips");
getSettings().forEach(setting -> setting.saveToConfiguration(_config));
_config.save();
}
@Override
public void setupConfiguration(Configuration config, String categoryId) {
fFreq = config.getFloat("foliageFreq", categoryId, 50f, 1f, 1000f, "Foliage noise pattern frequency (higher values = larger pattern)");
fMult = config.getFloat("foliageMult", categoryId, 7f, -50f, 50f, "Foliage noise pattern multiplier (higher values = stronger effect)");
fAdd = config.getFloat("foliageAdd", categoryId, 10f, -50f, 50f, "Foliage noise pattern bias (higher values = lighter colors");
wFreq = config.getFloat("waterFreq", categoryId, 50f, 1f, 1000f, "Water noise pattern frequency (higher values = larger pattern)");
wMult = config.getFloat("waterMult", categoryId, 14f, -50f, 50f, "Water noise pattern multiplier (higher values = stronger effect)");
wAdd = config.getFloat("waterAdd", categoryId, 15f, -50f, 50f, "Water noise pattern bias (higher values = lighter colors");
}
private static void commonpreInit(FMLPreInitializationEvent e) {
GalacticraftProxy.gtConf = new Configuration(new File(new File(e.getModConfigurationDirectory(), "GregTech"), "GregTech.cfg"));
GalacticraftProxy.uo_dimensionList.getConfig(GalacticraftProxy.gtConf, "undergroundfluid");
BW_WorldGenRoss128b.initundergroundFluids();
BW_WorldGenRoss128ba.init_undergroundFluids();
if (GalacticraftProxy.gtConf.hasChanged())
GalacticraftProxy.gtConf.save();
BW_WorldGenRoss128b.initOres();
BW_WorldGenRoss128ba.init_Ores();
MinecraftForge.EVENT_BUS.register(BWAtmosphereManager.INSTANCE);
}
public LoadingConfig(File file) {
if (!file.exists()) {
return;
}
Configuration config = new Configuration(file);
bugFixes = config.get("fixes", "bugFixes", true).getBoolean();
crashFixes = config.get("fixes", "crashFixes", true).getBoolean();
modSupport = config.get("fixes", "modSupport", true).getBoolean();
profiler = config.get("fixes", "profiler", true).getBoolean();
textureFixes = config.get("fixes", "textureFixes", true).getBoolean();
blockStates = config.get("fixes", "blockStates", true).getBoolean();
dynamicResources = config.get("fixes", "dynamicResources", true).getBoolean();
improvedLaunchWrapper = config.get("fixes", "improvedLaunchWrapper", true).getBoolean();
}
public YouTubeConfigurationGui(GuiScreen parentScreen) {
super(
parentScreen,
new ConfigElement(
YouTubeConfiguration.getInstance()
.getConfig()
.getCategory(Configuration.CATEGORY_GENERAL))
.getChildElements(),
YouTubeChat.MODID,
false,
false,
"YouTube Chat");
}
public static void preInit(FMLPreInitializationEvent event)
{
configDirectory = event.getModConfigurationDirectory();
config = new Configuration(new File(event.getModConfigurationDirectory(), Cyberware.MODID + ".cfg"));
startingItems = defaultStartingItems = new String[EnumSlot.values().length][0];
startingStacks = new ItemStack[EnumSlot.values().length][LibConstants.WARE_PER_SLOT];
int j = 0;
for (int i = 0; i < EnumSlot.values().length; i++)
{
if (EnumSlot.values()[i].hasEssential())
{
if (EnumSlot.values()[i].isSided())
{
defaultStartingItems[i] = new String[] { "cyberware:bodyPart 1 " + j, "cyberware:bodyPart 1 " + (j + 1) };
j += 2;
}
else
{
defaultStartingItems[i] = new String[] { "cyberware:bodyPart 1 " + j };
j++;
}
}
else
{
defaultStartingItems[i] = new String[0];
}
}
loadConfig();
config.load();
for (int index = 0; index < EnumSlot.values().length; index++)
{
EnumSlot slot = EnumSlot.values()[index];
startingItems[index] = config.getStringList("Default augments for " + slot.getName() + " slot",
"Defaults", defaultStartingItems[index], "Use format 'id amount metadata'");
}
config.save();
}
/** Initialize scoing. */
static public void update(Configuration configs)
{
scoringPolicy = configs.get(MalmoMod.SCORING_CONFIGS, "policy", DEFAULT_NO_SCORING).getInt();
if (scoringPolicy > 0) {
String customLogHandler = configs.get(MalmoMod.SCORING_CONFIGS, "handler", "").getString();
setLogging(Level.INFO, customLogHandler);
}
if (logging)
log("<ScoreInit><Policy>" + scoringPolicy + "</Policy></ScoreInit>");
}
@Override
public void saveToConfig(){
Configuration config = Config.config;
config.load();
config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Block_Tracker", "stat X", -1).set(blockTrackInfo.getBaseX());
config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Block_Tracker", "stat Y", 46).set(blockTrackInfo.getBaseY());
config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Block_Tracker", "stat leftsided", true).set(blockTrackInfo.isLeftSided());
statX = blockTrackInfo.getBaseX();
statY = blockTrackInfo.getBaseY();
statLeftSided = blockTrackInfo.isLeftSided();
config.save();
}
public static void doNormalConfig(File file)
{
Configuration config = new Configuration(file);
config.load();
enableBarrels = config.get("Mechanics", "barrels", true).getBoolean();
enableCrucible = config.get("Mechanics", "crucible", true).getBoolean();
shouldBarrelsFillWithRain = config.get("Mechanics", "barrelsFillWithRain", true).getBoolean();
fakePlayersCanSieve = config.get("Mechanics", "fakePlayersCanSieve", false).getBoolean();
compostingTicks = config.get("Composting", "ticksToFormDirt", 600).getInt();
infestedLeavesTicks = config.get("Infested Leaves","ticksToTransform",600).getInt();
leavesUpdateFrequency = config.get("Infested Leaves", "leavesUpdateFrequency", 40).getInt();
leavesSpreadChance = config.get("Infested Leaves", "leavesSpreadChance", 0.0015).getDouble();
doLeavesUpdateClient = config.get("Infested Leaves", "doLeavesUpdateClient", true).getBoolean();
enableBarrelTransformLighting = config.get("Misc", "enableBarrelTransformLighting", true).getBoolean();
stringChance = config.get("Crooking", "stringChance", 1).getDouble();
stringFortuneChance = config.get("Crooking", "stringFortuneChance", 1).getDouble();
sieveSimilarRadius = config.get("Sieving", "sieveSimilarRadius", 2).getInt();
doEnderIOCompat = config.get("Compatibilitiy", "EnderIO", true).getBoolean();
doTICCompat = config.get("Compatibilitiy", "TinkersConstruct", true).getBoolean();
doTOPCompat = config.get("Compatibilitiy", "TheOneProbe", true).getBoolean();
shouldOreDictOreChunks = config.get("Compatibilitiy", "OreDictOreChunks", true).getBoolean();
shouldOreDictOreDusts = config.get("Compatibilitiy", "OreDictOreDusts", true).getBoolean();
setFireToMacroUsers = config.get("Sieving", "setFireToMacroUsers", false).getBoolean();
sievesAutoOutput = config.get("Sieving", "sievesAutoOutput", false).getBoolean();
numberOfTimesToTestVanillaDrops = config.get("Crooking", "numberOfVanillaDropRuns", 3).getInt();
if (config.hasChanged())
config.save();
}
private static IConfigElement createModConfig() {
final Configuration config = OpenPeripheralCore.instance.config();
final List<IConfigElement> result = Lists.newArrayList();
for (String categoryName : config.getCategoryNames()) {
if (!categoryName.equalsIgnoreCase(Config.CATEGORY_FEATURE_GROUPS)) {
ConfigCategory category = config.getCategory(categoryName);
result.add(new ConfigElement(category));
}
}
return new DummyCategoryElement("modConfig", "openperipheralcore.config.miscConfig", result);
}
@Override
protected void loadConfig(Configuration config) {
super.loadConfig(config);
if (this.defaults.speedVertical != null) {
this.speedVertical = config.get(this.defaults.section.name, "Vertical Speed", this.defaults.speedVertical, "The maximum vertical speed of this jetpack when flying.").setMinValue(0.0D).getDouble(this.defaults.speedVertical);
}
if (this.defaults.accelVertical != null) {
this.accelVertical = config.get(this.defaults.section.name, "Vertical Acceleration", this.defaults.accelVertical, "The vertical acceleration of this jetpack when flying; every tick, this amount of vertical speed will be added until maximum speed is reached.").setMinValue(0.0D).getDouble(this.defaults.accelVertical);
}
if (this.defaults.speedVerticalHover != null) {
this.speedVerticalHover = config.get(this.defaults.section.name, "Vertical Speed (Hover Mode)", this.defaults.speedVerticalHover, "The maximum vertical speed of this jetpack when flying in hover mode.").setMinValue(0.0D).getDouble(this.defaults.speedVerticalHover);
}
if (this.defaults.speedVerticalHoverSlow != null) {
this.speedVerticalHoverSlow = config.get(this.defaults.section.name, "Vertical Speed (Hover Mode / Slow Descent)", this.defaults.speedVerticalHoverSlow, "The maximum vertical speed of this jetpack when slowly descending in hover mode.").setMinValue(0.0D).getDouble(this.defaults.speedVerticalHoverSlow);
}
if (this.defaults.speedSideways != null) {
this.speedSideways = config.get(this.defaults.section.name, "Sideways Speed", this.defaults.speedSideways, "The speed of this jetpack when flying sideways. This is mostly noticeable in hover mode.").setMinValue(0.0D).getDouble(this.defaults.speedSideways);
}
if (this.defaults.sprintSpeedModifier != null) {
this.sprintSpeedModifier = config.get(this.defaults.section.name, "Sprint Speed Multiplier", this.defaults.sprintSpeedModifier, "How much faster this jetpack will fly forward when sprinting. Setting this to 1.0 will make sprinting have no effect apart from the added speed from vanilla.").setMinValue(0.0D).getDouble(this.defaults.sprintSpeedModifier);
}
if (this.defaults.sprintFuelModifier != null) {
this.sprintFuelModifier = config.get(this.defaults.section.name, "Sprint Fuel Usage Multiplier", this.defaults.sprintFuelModifier, "How much more energy this jetpack will use when sprinting. Setting this to 1.0 will make sprinting have no effect on energy usage.").setMinValue(0.0D).getDouble(this.defaults.sprintFuelModifier);
}
if (this.defaults.emergencyHoverMode != null) {
this.emergencyHoverMode = config.get(this.defaults.section.name, "Emergency Hover Mode", this.defaults.emergencyHoverMode, "When enabled, this jetpack will activate hover mode automatically when the wearer is about to die from a fall.").getBoolean(this.defaults.emergencyHoverMode);
}
}
/**
* Enables metrics for the server by setting "opt-out" to false in the
* config file and starting the metrics task.
*
* @throws java.io.IOException
*/
public void enable() throws IOException {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.getCategory(Configuration.CATEGORY_GENERAL).get("opt-out").set("false");
configuration.save();
}
// Enable Task, if it is not running
FMLCommonHandler.instance().bus().register(this);
}
/**
* Enables metrics for the server by setting "opt-out" to false in the
* config file and starting the metrics task.
*
* @throws java.io.IOException
*/
public void enable() throws IOException {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.getCategory(Configuration.CATEGORY_GENERAL).get("opt-out").set("false");
configuration.save();
}
// Enable Task, if it is not running
FMLCommonHandler.instance().bus().register(this);
}
/**
* Enables metrics for the server by setting "opt-out" to false in the
* config file and starting the metrics task.
*
* @throws java.io.IOException
*/
public void enable() throws IOException {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.getCategory(Configuration.CATEGORY_GENERAL).get("opt-out").set("false");
configuration.save();
}
// Enable Task, if it is not running
FMLCommonHandler.instance().bus().register(this);
}
/**
* Enables metrics for the server by setting "opt-out" to false in the
* config file and starting the metrics task.
*
* @throws java.io.IOException
*/
public void enable() throws IOException {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.getCategory(Configuration.CATEGORY_GENERAL).get("opt-out").set("false");
configuration.save();
}
// Enable Task, if it is not running
FMLCommonHandler.instance().bus().register(this);
}
/**
* Enables metrics for the server by setting "opt-out" to false in the
* config file and starting the metrics task.
*
* @throws java.io.IOException
*/
public void enable() throws IOException {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.getCategory(Configuration.CATEGORY_GENERAL).get("opt-out").set("false");
configuration.save();
}
// Enable Task, if it is not running
FMLCommonHandler.instance().bus().register(this);
}
public static void loadConfigsFromFile(File configFile)
{
configurationFile = configFile;
config = new Configuration(configurationFile, null, true);
config.load();
reLoadAllConfigs(false);
}
@Override
public void initConfig(Configuration config){
powerStatX = config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Power_Stat", "stat X", -1).getInt();
powerStatY = config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Power_Stat", "stat Y", 2).getInt();
powerStatLeftSided = config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Power_Stat", "stat leftsided", true).getBoolean(true);
messagesStatX = config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Message_Stat", "stat X", 2).getInt();
messagesStatY = config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Message_Stat", "stat Y", 2).getInt();
messagesStatLeftSided = config.get("Helmet_Options" + Configuration.CATEGORY_SPLITTER + "Message_Stat", "stat leftsided", false).getBoolean(true);
}