Search in sources :

Example 21 with Configuration

use of net.minecraftforge.common.config.Configuration in project PneumaticCraft by MineMaarten.

the class Config method init.

public static void init(File configFile) {
    if (configFile != null) {
        //TODO remove legacy.
        File oldConfig = new File(configFile.getAbsolutePath().replace("PneumaticCraft", "Minemaarten_PneumaticCraft"));
        if (oldConfig.exists())
            configFile = oldConfig;
        config = new Configuration(configFile);
        // get the actual data from the file.
        config.load();
        for (ISubConfig subConfig : subConfigs) {
            File subFolder = new File(configFile.getAbsolutePath().substring(0, configFile.getAbsolutePath().length() - 4) + File.separator);
            subFolder.mkdirs();
            File subFile = new File(subFolder, subConfig.getFolderName() + ".cfg");
            try {
                subConfig.init(subFile);
            } catch (IOException e) {
                Log.error("Config file " + subConfig.getFolderName() + " failed to create! Unexpected things can happen!");
                e.printStackTrace();
            }
        }
    }
    boolean foundConfigWithoutOil = !config.hasKey(Configuration.CATEGORY_GENERAL, "oil_generation_chance");
    oilGenerationChance = config.get(Configuration.CATEGORY_GENERAL, "oil_generation_chance", 15D, "Chance per chunk in percentage to generate an Oil Lake. Set to 0 for no spawns").getDouble();
    config.addCustomCategoryComment("plant_full-grown_effects", "When true, the plant is allowed to execute its full-grown effect. (When false bonemeal still works though)");
    for (int i = 0; i < 16; i++) {
        Property prop = config.get("plant_full-grown_effects", ItemPlasticPlants.PLANT_NAMES[i], false);
        configPlantFullGrownEffect[i] = prop.getBoolean(false);
        if (foundConfigWithoutOil && configPlantFullGrownEffect[i]) {
            prop.set(false);
            configPlantFullGrownEffect[i] = false;
            shouldDisplayChangeNotification = true;
        }
    }
    config.addCustomCategoryComment("plant_generation_options", "The percentage chance of plant groups to spawn per chunk. 0 for no spawns, 100 for a group for every chunk");
    for (int i = 0; i < 16; i++) {
        if (!ItemPlasticPlants.NEEDS_GENERATION[i])
            continue;
        double defaultValue = 0;
        Property prop = config.get("plant_generation_options", ItemPlasticPlants.PLANT_NAMES[i], defaultValue);
        configPlantGenerationChance[i] = prop.getDouble() / 100;
        if (foundConfigWithoutOil && configPlantGenerationChance[i] > 0) {
            prop.set(0D);
            configPlantGenerationChance[i] = 0;
            shouldDisplayChangeNotification = true;
        }
    }
    Property property = config.get(Configuration.CATEGORY_GENERAL, "Compressed Iron Loss Percentage", 20);
    property.comment = "Loss percentage (on average) of Compressed Iron ingots/blocks when exposed to an explosion.";
    configCompressedIngotLossRate = property.getInt();
    property = config.get(Configuration.CATEGORY_GENERAL, "Enable Dungeon Loot generation", true);
    property.comment = "Enables the dungeon loot generation of the Nuke Virus and Stop! Worm. Useless items when playing SSP.";
    enableDungeonLoot = property.getBoolean();
    useHelmetModel = config.getBoolean("Use Pneumatic Helmet model", Configuration.CATEGORY_GENERAL, false, "When true, the Pneumatic Helmet will be a model. Warning: this model looks far too good to be in MC");
    programmerDifficulty = config.getInt("Programmer Difficulty", Configuration.CATEGORY_GENERAL, 0, 0, 2, "Defines the difficulty of the programmer shown to the user. 0 = easy, 1 = medium, 2 = advanced");
    property = config.get(Configuration.CATEGORY_GENERAL, "Villager Mechanic ID", 125);
    property.comment = "Villager ID used for the Mechanic Villager. Change when ID collides with an other mod which adds villagers.";
    villagerMechanicID = property.getInt();
    property = config.get(Configuration.CATEGORY_GENERAL, "Minigun damage", 4D);
    property.comment = "Damage of the Miniguns. This applies to the Sentry Gun, Handheld Minigun, and Drone-based minigun.";
    configMinigunDamage = (float) property.getDouble();
    property = config.get("Machine_Properties", "Pneumatic Generator (PneumaticCraft --> IC2) efficiency", 40);
    property.comment = "Changing this value will alter the pressurized air usage of the Pneumatic Generator. The output, EU, will stay the same.";
    pneumaticGeneratorEfficiency = property.getInt();
    property = config.get("machine_properties", "Electric Compressor (IC2 --> PneumaticCraft) efficiency", 40);
    property.comment = "Changing this value will alter the pressurized air production of the Electric Compressor. The input, EU, will stay the same.";
    electricCompressorEfficiency = property.getInt();
    property = config.get("machine_properties", "Pneumatic Engine (PneumaticCraft --> Buildcraft) efficiency", 40);
    property.comment = "Changing this value will alter the pressurized air usage of the Pneumatic Engine. The output, MJ, will stay the same.";
    pneumaticEngineEfficiency = property.getInt();
    property = config.get("machine_properties", "Kinetic Compressor (Buildcraft --> PneumaticCraft) efficiency", 40);
    property.comment = "Changing this value will alter the pressurized air production of the Kinetic Compressor. The input, MJ, will stay the same.";
    kineticCompressorEfficiency = property.getInt();
    property = config.get("machine_properties", "Pneumatic Dynamo (PneumaticCraft --> RF) efficiency", 40);
    property.comment = "Changing this value will alter the pressurized air usage of the Pneumatic Dynamo. The output, RF, will stay the same.";
    pneumaticDynamoEfficiency = property.getInt();
    property = config.get("machine_properties", "Flux Compressor (RF --> PneumaticCraft) efficiency", 40);
    property.comment = "Changing this value will alter the pressurized air production of the Flux Compressor. The input, RF, will stay the same.";
    fluxCompressorEfficiency = property.getInt();
    property = config.get("machine_properties", "Pneumatic Pump (PneumaticCraft --> Hydraulicraft) efficiency", 40);
    property.comment = "Changing this value will alter the hydraulic bar production of the Pneumatic Pump. The input, air, will stay the same.";
    pneumaticPumpEfficiency = property.getInt();
    elevatorBaseBlocksPerBase = config.getInt("Height per Elevator Base", "machine_properties", 4, 1, 256, "The max height of an elevator per stacked Elevator Base.");
    property = config.get("advanced", "Convert Multiparts to Blocks", false);
    property.comment = "ONLY SET TO TRUE WHEN YOU KNOW WHAT YOU'RE DOING. When set to true, this will convert any Pressure Tube in the world that was a FMP to its block variant. Handy when you're about to remove FMP from the instance. This will remove any other parts from the block like covers. Exception are tube modules.";
    convertMultipartsToBlocks = property.getBoolean(true);
    property = config.get("advanced", "Stop Drone AI", false);
    property.comment = "When set to true, Drones will not execute any program. This is useful to set to true when due to a bug Drones are lagging your server or crashing it. Please report the bug if you encounter it.";
    stopDroneAI = property.getBoolean(true);
    property = config.get("advanced", "Disable Kerosene Lamp Fake Air Block", false);
    property.comment = "When set to true, the Kerosene Lamp's fake air blocks won't be registered and therefore removed from the world. Useful if this causes trouble (it shouldn't though)";
    disableKeroseneLampFakeAirBlock = property.getBoolean(true);
    enableUpdateChecker = config.get(Configuration.CATEGORY_GENERAL, "Enable Update Checker", true).getBoolean(true);
    enableDroneSuffocationDamage = config.get(Configuration.CATEGORY_GENERAL, "Enable Drone Suffocation Damage", true).getBoolean(true);
    enableCreeperDropExplosion = config.getBoolean("Enable Creeper Explosions on seed drop", Configuration.CATEGORY_GENERAL, false, "When true, Creepers when dropping a Creeper Plant Seed will create a tiny explosion.");
    enableCreeperSeedDrop = config.get(Configuration.CATEGORY_GENERAL, "Enable Creeper Seed Drops", false).getBoolean(true);
    enableSlimeSeedDrop = config.get(Configuration.CATEGORY_GENERAL, "Enable Slime Seed Drops", false).getBoolean(true);
    enableEndermanSeedDrop = config.get(Configuration.CATEGORY_GENERAL, "Enable Enderman Seed Drops", false).getBoolean(true);
    enableSquidSeedDrop = config.get(Configuration.CATEGORY_GENERAL, "Enable Squid Seed Drops", false).getBoolean(true);
    includePlantsOnBonemeal = config.get(Configuration.CATEGORY_GENERAL, "Include Plastic Plants on bonemealing", false).getBoolean(true);
    allowDirtBonemealing = config.get(Configuration.CATEGORY_GENERAL, "Allow dirt to be bonemealed for plastic plants", false).getBoolean(true);
    if (foundConfigWithoutOil && (enableCreeperDropExplosion || enableCreeperSeedDrop || enableSlimeSeedDrop || enableEndermanSeedDrop || enableSquidSeedDrop || includePlantsOnBonemeal || allowDirtBonemealing)) {
        enableCreeperDropExplosion = enableCreeperSeedDrop = enableSlimeSeedDrop = enableEndermanSeedDrop = enableSquidSeedDrop = includePlantsOnBonemeal = allowDirtBonemealing = false;
        config.get(Configuration.CATEGORY_GENERAL, "Enable Creeper Explosions on seed drop", true, "When true, Creepers when dropping a Creeper Plant Seed will create a tiny explosion.").set(false);
        config.get(Configuration.CATEGORY_GENERAL, "Enable Creeper Seed Drops", true).set(false);
        config.get(Configuration.CATEGORY_GENERAL, "Enable Slime Seed Drops", true).set(false);
        config.get(Configuration.CATEGORY_GENERAL, "Enable Enderman Seed Drops", true).set(false);
        config.get(Configuration.CATEGORY_GENERAL, "Enable Squid Seed Drops", true).set(false);
        config.get(Configuration.CATEGORY_GENERAL, "Include Plastic Plants on bonemealing", true).set(false);
        config.get(Configuration.CATEGORY_GENERAL, "Allow dirt to be bonemealed for plastic plants", true).set(false);
        shouldDisplayChangeNotification = true;
    }
    if (shouldDisplayChangeNotification) {
        Log.warning("Disabled world generation of plants and plant mob drops in the config automatically, oil is turned on as replacement. This is only done once, you can change it as you wish now.");
    }
    enableCoalToDiamondsRecipe = config.get("recipe_enabling", "8 Block of Coal --> 1 Diamond (Pressure Chamber)", true).getBoolean(true);
    enableElectricCompressorRecipe = config.get("recipe_enabling", "Electric Compressor", true).getBoolean(true);
    enablePneumaticGeneratorRecipe = config.get("recipe_enabling", "Pneumatic Generator", true).getBoolean(true);
    enablePneumaticPumpRecipe = config.get("recipe_enabling", "Pneumatic Pump", true).getBoolean(true);
    enableCreeperPlantMaceratorRecipe = config.get("recipe_enabling", "Creeper Plant Seeds --> Gunpowder (IC2 Macerator)", true).getBoolean(true);
    enableHeliumPlantMaceratorRecipe = config.get("recipe_enabling", "Helium Plant Seeds --> Glowstone (IC2 Macerator)", true).getBoolean(true);
    enableFlyingFlowerExtractorRecipe = config.get("recipe_enabling", "Flying Flower Seeds --> Feather (IC2 Extractor)", true).getBoolean(true);
    enablePropulsionPlantExtractorRecipe = config.get("recipe_enabling", "Propulsion Plant Seeds --> Sugar (IC2 Extractor)", true).getBoolean(true);
    PneumaticCraft.proxy.initConfig(config);
    // save the configuration file
    config.save();
}
Also used : Configuration(net.minecraftforge.common.config.Configuration) IOException(java.io.IOException) File(java.io.File) Property(net.minecraftforge.common.config.Property)

Example 22 with Configuration

use of net.minecraftforge.common.config.Configuration in project SimplyJetpacks by Tonius.

the class Config method preInit.

public static void preInit(FMLPreInitializationEvent evt) {
    FMLCommonHandler.instance().bus().register(new Config());
    config = new Configuration(new File(evt.getModConfigurationDirectory(), SimplyJetpacks.MODID + ".cfg"));
    configClient = new Configuration(new File(evt.getModConfigurationDirectory(), SimplyJetpacks.MODID + "-client.cfg"));
    syncConfig();
    SimplyJetpacks.proxy.updateCustomKeybinds(flyKey, descendKey);
}
Also used : Configuration(net.minecraftforge.common.config.Configuration) File(java.io.File)

Example 23 with Configuration

use of net.minecraftforge.common.config.Configuration in project LogisticsPipes by RS485.

the class Configs method load.

public static void load() {
    if (Configs.loaded) {
        return;
    }
    if (Loader.instance().getConfigDir() == null) {
        return;
    }
    Configs.CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), "LogisticsPipes.cfg"));
    Configs.CONFIGURATION.load();
    Configs.loaded = true;
    if (Configs.CONFIGURATION.hasCategory("logisticspipe.id") || Configs.CONFIGURATION.hasCategory("logisticsPipe.id")) {
        throw new RuntimeException("Old config, please remove it and manually reconfigure LogisticPipes");
    }
    Configs.LOGISTICS_DETECTION_LENGTH = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "detectionLength", Configs.LOGISTICS_DETECTION_LENGTH, "The maximum shortest length between logistics pipes. This is an indicator on the maxim depth of the recursion algorithm to discover logistics neighbours. A low value might use less CPU, a high value will allow longer pipe sections").getInt();
    Configs.LOGISTICS_DETECTION_COUNT = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "detectionCount", Configs.LOGISTICS_DETECTION_COUNT, "The maximum number of buildcraft pipes (including forks) between logistics pipes. This is an indicator of the maximum amount of nodes the recursion algorithm will visit before giving up. As it is possible to fork a pipe connection using standard BC pipes the algorithm will attempt to discover all available destinations through that pipe. Do note that the logistics system will not interfere with the operation of non-logistics pipes. So a forked pipe will usually be sup-optimal, but it is possible. A low value might reduce CPU usage, a high value will be able to handle more complex pipe setups. If you never fork your connection between the logistics pipes this has the same meaning as detectionLength and the lower of the two will be used").getInt();
    Configs.LOGISTICS_DETECTION_FREQUENCY = Math.max(Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "reDetectionFrequency", Configs.LOGISTICS_DETECTION_FREQUENCY, "The amount of time that passes between checks to see if it is still connected to its neighbours (Independently from block place detection). A low value will mean that it will correct wrong values faster but use more CPU. A high value means error correction takes longer, but CPU consumption is reduced. A value of 20 will check about every second (default 600 [30 seconds])").getInt(), 1);
    Configs.MAX_ROBOT_DISTANCE = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "maxRobotDistance", Configs.MAX_ROBOT_DISTANCE, "The max. distance between two robots when there is no zone defined.").getInt();
    Configs.LOGISTICS_ORDERER_COUNT_INVERTWHEEL = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "ordererCountInvertWheel", Configs.LOGISTICS_ORDERER_COUNT_INVERTWHEEL, "Inverts the the mouse wheel scrolling for remote order number of items").getBoolean(false);
    Configs.LOGISTICS_ORDERER_PAGE_INVERTWHEEL = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "ordererPageInvertWheel", Configs.LOGISTICS_ORDERER_PAGE_INVERTWHEEL, "Inverts the the mouse wheel scrolling for remote order pages").getBoolean(false);
    Configs.LOGISTICS_POWER_USAGE_DISABLED = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "powerUsageDisabled", Configs.LOGISTICS_POWER_USAGE_DISABLED, "Disable the power usage trough LogisticsPipes").getBoolean(false);
    Configs.LOGISTICS_HUD_RENDER_DISTANCE = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "HUDRenderDistance", Configs.LOGISTICS_HUD_RENDER_DISTANCE, "The max. distance between a player and the HUD that get's shown in blocks.").getInt();
    Configs.DISPLAY_POPUP = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "displayPopup", Configs.DISPLAY_POPUP, "Set the default configuration for the popup of the Orderer Gui. Should it be used?").getBoolean(false);
    Configs.MANDATORY_CARPENTER_RECIPES = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "mandatoryCarpenterRecipes", Configs.MANDATORY_CARPENTER_RECIPES, "Whether or not the Carpenter is required to craft Forestry related pipes/modules.").getBoolean(false);
    Configs.ENABLE_PARTICLE_FX = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "enableParticleFX", Configs.ENABLE_PARTICLE_FX, "Whether or not special particles will spawn.").getBoolean(false);
    if (Configs.CONFIGURATION.hasKey(Configs.CATEGORY_MULTITHREAD, "enabled")) {
        //ConfigCategory.remove is deprecated, but there's no other way to remove a key-value pair without completely recreating the config...
        Configs.CONFIGURATION.getCategory(Configs.CATEGORY_MULTITHREAD).remove(new String("enabled"));
    }
    Configs.MULTI_THREAD_NUMBER = Configs.CONFIGURATION.get(Configs.CATEGORY_MULTITHREAD, "count", Configs.MULTI_THREAD_NUMBER, "Number of routing table update Threads, 0 to disable.").getInt();
    if (Configs.MULTI_THREAD_NUMBER < 0) {
        Configs.MULTI_THREAD_NUMBER = 0;
        Configs.CONFIGURATION.get(Configs.CATEGORY_MULTITHREAD, "count", Configs.MULTI_THREAD_NUMBER, "Number of routing table update Threads, 0 to disable.").set(Integer.toString(Configs.MULTI_THREAD_NUMBER));
    }
    Configs.MULTI_THREAD_PRIORITY = Configs.CONFIGURATION.get(Configs.CATEGORY_MULTITHREAD, "priority", Configs.MULTI_THREAD_PRIORITY, "Priority of the multiThread Threads. 10 is highest, 5 normal, 1 lowest").getInt();
    if (Configs.MULTI_THREAD_PRIORITY < 1 || Configs.MULTI_THREAD_PRIORITY > 10) {
        Configs.MULTI_THREAD_PRIORITY = Thread.NORM_PRIORITY;
        Configs.CONFIGURATION.get(Configs.CATEGORY_MULTITHREAD, "priority", Configs.MULTI_THREAD_PRIORITY, "Priority of the multiThread Threads. 10 is highest, 5 normal, 1 lowest").set(Integer.toString(Thread.NORM_PRIORITY));
    }
    Configs.POWER_USAGE_MULTIPLIER = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "powerUsageMultiplyer", Configs.POWER_USAGE_MULTIPLIER, "A Multiplyer for the power usage.").getDouble(Configs.POWER_USAGE_MULTIPLIER);
    if (Configs.POWER_USAGE_MULTIPLIER <= 0) {
        Configs.POWER_USAGE_MULTIPLIER = 1;
        Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "powerUsageMultiplyer", Configs.POWER_USAGE_MULTIPLIER, "A Multiplyer for the power usage.").set(1);
    }
    Configs.LOGISTICS_CRAFTING_TABLE_POWER_USAGE = Math.max(Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "logisticsCraftingTablePowerUsage", Configs.LOGISTICS_CRAFTING_TABLE_POWER_USAGE, "Number of LPower units the Logistics Crafting Table uses per craft.").getInt(), 0);
    Configs.CHECK_FOR_UPDATES = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "checkForUpdates", Configs.CHECK_FOR_UPDATES, "Should LogisticsPipes check for updates?").getBoolean(false);
    Configs.OPAQUE = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "OpaquePipes", Configs.OPAQUE, "Render every LP pipe opaque.").getBoolean(false);
    Configs.EASTER_EGGS = Configs.CONFIGURATION.get(Configuration.CATEGORY_GENERAL, "easterEggs", Configs.EASTER_EGGS, "Do you fancy easter eggs?").getBoolean(false);
    Configs.CONFIGURATION.save();
}
Also used : Configuration(net.minecraftforge.common.config.Configuration) File(java.io.File)

Example 24 with Configuration

use of net.minecraftforge.common.config.Configuration in project SecurityCraft by Geforce132.

the class mod_SecurityCraft method preInit.

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    log("Starting to load....");
    log("Loading config file....");
    log(mod_SecurityCraft.VERSION + " of SecurityCraft is for a post MC-1.6.4 version! Configuration files are useless for setting anything besides options.");
    mod_SecurityCraft.configFile = new Configuration(event.getSuggestedConfigurationFile());
    this.configHandler.setupConfiguration();
    log("Config file loaded.");
    log("Setting up handlers!");
    this.configHandler.setupHandlers(event);
    log("Handlers registered.");
    log("Setting up network....");
    mod_SecurityCraft.network = NetworkRegistry.INSTANCE.newSimpleChannel(mod_SecurityCraft.MODID);
    this.configHandler.setupPackets(mod_SecurityCraft.network);
    log("Network setup.");
    log("Loading mod additions...");
    this.configHandler.setupAdditions();
    if (this.debuggingMode) {
        this.configHandler.setupDebugAdditions();
    }
    log("Finished loading mod additions.");
    log("Doing registering stuff... (PT 1/2)");
    this.configHandler.setupGameRegistry();
    ModMetadata modMeta = event.getModMetadata();
    modMeta.authorList = Arrays.asList(new String[] { "Geforce" });
    modMeta.autogenerated = false;
    modMeta.credits = "Thanks to all of you guys for your support!";
    modMeta.description = "Adds a load of things to keep your house safe with.\nIf you like this mod, hit the green arrow\nin the corner of the forum thread!\nPlease visit the URL above for help. \n \nMessage of the update: \n" + MOTU;
    modMeta.url = "http://geforce.freeforums.org";
}
Also used : Configuration(net.minecraftforge.common.config.Configuration) ModMetadata(cpw.mods.fml.common.ModMetadata) ForgeEventHandler(org.freeforums.geforce.securitycraft.handlers.ForgeEventHandler) EventHandler(cpw.mods.fml.common.Mod.EventHandler)

Example 25 with Configuration

use of net.minecraftforge.common.config.Configuration in project OpenModularTurrets by OpenModularTurretsTeam.

the class ConfigHandler method init.

public static void init(File configFile) {
    Configuration config = new Configuration(configFile);
    config.load();
    baseTierOneMaxCharge = config.get("TurretBaseTierOne", "MaxCharge", 500).getInt();
    baseTierOneMaxIo = config.get("TurretBaseTierOne", "MaxIo", 50).getInt();
    baseTierOneBlastResistance = config.get("TurretBaseTierOne", "BlastResistance", 5).getInt();
    baseTierOneHardness = config.get("TurretBaseTierOne", "Hardness", 20).getInt();
    baseTierTwoMaxCharge = config.get("TurretBaseTierTwo", "MaxCharge", 50000).getInt();
    baseTierTwoMaxIo = config.get("TurretBaseTierTwo", "MaxIo", 100).getInt();
    baseTierTwoBlastResistance = config.get("TurretBaseTierTwo", "BlastResistance", 10).getInt();
    baseTierTwoHardness = config.get("TurretBaseTierTwo", "Hardness", 30).getInt();
    baseTierThreeMaxCharge = config.get("TurretBaseTierThree", "MaxCharge", 150000).getInt();
    baseTierThreeMaxIo = config.get("TurretBaseTierThree", "MaxIo", 500).getInt();
    baseTierThreeBlastResistance = config.get("TurretBaseTierThree", "BlastResistance", 15).getInt();
    baseTierThreeHardness = config.get("TurretBaseTierThree", "Hardness", 40).getInt();
    baseTierFourMaxCharge = config.get("TurretBaseTierFour", "MaxCharge", 500000).getInt();
    baseTierFourMaxIo = config.get("TurretBaseTierFour", "MaxIo", 1500).getInt();
    baseTierFourBlastResistance = config.get("TurretBaseTierFour", "BlastResistance", 20).getInt();
    baseTierFourHardness = config.get("TurretBaseTierFour", "Hardness", 50).getInt();
    baseTierFiveMaxCharge = config.get("TurretBaseTierFive", "MaxCharge", 10000000).getInt();
    baseTierFiveMaxIo = config.get("TurretBaseTierFive", "MaxIo", 5000).getInt();
    baseTierFiveBlastResistance = config.get("TurretBaseTierFive", "BlastResistance", 25).getInt();
    baseTierFiveHardness = config.get("TurretBaseTierFive", "Hardness", 60).getInt();
    disposable_turret = new TurretSetting(config.get("TurretDisposable", "Range", 10, "Turret range, in blocks").getInt(), config.get("TurretDisposable", "FireRateCooldown", 25, "Number of ticks between firings").getInt(), config.get("TurretDisposable", "Damage", 2, "Measured in half-hearts").getInt(), config.get("TurretDisposable", "Accuracy", 50, "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.").getDouble(), config.get("TurretDisposable", "PowerUsage", 2, "RF used per shot").getInt(), config.get("TurretDisposable", "Enabled", true, "Enabled?").getBoolean(), config.get("TurretDisposable", "DamageAmpBonus", 0.05F, "Value of the bonus damage (relative to HP of enemy target) for the turret per damage amp addon.").getDouble());
    potato_cannon_turret = new TurretSetting(config.get("TurretPotatoCannon", "Range", 15, "Turret range, in blocks").getInt(), config.get("TurretPotatoCannon", "FireRateCooldown", 35, "Number of ticks between firings").getInt(), config.get("TurretPotatoCannon", "Damage", 3, "Measured in half-hearts").getInt(), config.get("TurretPotatoCannon", "Accuracy", 30, "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.").getDouble(), config.get("TurretPotatoCannon", "PowerUsage", 10, "RF used per shot").getInt(), config.get("TurretPotatoCannon", "Enabled", true, "Enabled?").getBoolean(), config.get("TurretPotatoCannon", "DamageAmpBonus", 0.05F, "Value of the bonus damage (relative to HP of enemy target) for the turret per damage amp addon.").getDouble());
    machine_gun_turret = new TurretSetting(config.get("TurretMachineGun", "Range", 18, "Turret range, in blocks").getInt(), config.get("TurretMachineGun", "FireRateCooldown", 8, "Number of ticks between firings").getInt(), config.get("TurretMachineGun", "Damage", 2, "Measured in half-hearts").getInt(), config.get("TurretMachineGun", "Accuracy", 30, "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.").getDouble(), config.get("TurretMachineGun", "PowerUsage", 100, "RF used per shot").getInt(), config.get("TurretMachineGun", "Enabled", true, "Enabled?").getBoolean(), config.get("TurretMachineGun", "DamageAmpBonus", 0.06F, "Value of the bonus damage (relative to HP of enemy target) for the turret per damage amp addon.").getDouble());
    incendiary_turret = new TurretSetting(config.get("TurretIncendiary", "Range", 12, "Turret range, in blocks").getInt(), config.get("TurretIncendiary", "FireRateCooldown", 25, "Number of ticks between firings").getInt(), config.get("TurretIncendiary", "Damage", 2, "Measured in half-hearts").getInt(), config.get("TurretIncendiary", "Accuracy", 30, "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.").getDouble(), config.get("TurretIncendiary", "PowerUsage", 250, "RF used per shot").getInt(), config.get("TurretIncendiary", "Enabled", true, "Enabled?").getBoolean(), config.get("TurretIncendiary", "DamageAmpBonus", 0.05F, "Value of the bonus damage (relative to HP of enemy target) for the turret per damage amp addon.").getDouble());
    grenade_turret = new TurretSetting(config.get("TurretGrenade", "Range", 20, "Turret range, in blocks").getInt(), config.get("TurretGrenade", "FireRateCooldown", 40, "Number of ticks between firings").getInt(), config.get("TurretGrenade", "Damage", 8, "Measured in half-hearts").getInt(), config.get("TurretGrenade", "Accuracy", 30, "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.").getDouble(), config.get("TurretGrenade", "PowerUsage", 3000, "RF used per shot").getInt(), config.get("TurretGrenade", "Enabled", true, "Enabled?").getBoolean(), config.get("TurretGrenade", "DamageAmpBonus", 0.08F, "Value of the bonus damage (relative to HP of enemy target) for the turret per damage amp addon.").getDouble());
    relativistic_turret = new TurretSetting(config.get("TurretRelativistic", "Range", 20, "Turret range, in blocks").getInt(), config.get("TurretRelativistic", "FireRateCooldown", 100, "Number of ticks between firings").getInt(), config.get("TurretRelativistic", "Damage", 0, "Measured in half-hearts").getInt(), config.get("TurretRelativistic", "Accuracy", 0, "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.").getDouble(), config.get("TurretRelativistic", "PowerUsage", 5000, "RF used per shot").getInt(), config.get("TurretRelativistic", "Enabled", true, "Enabled?").getBoolean(), 0);
    rocket_turret = new TurretSetting(config.get("TurretRocket", "Range", 30, "Turret range, in blocks").getInt(), config.get("TurretRocket", "FireRateCooldown", 30, "Number of ticks between firings").getInt(), config.get("TurretRocket", "Damage", 10, "Measured in half-hearts").getInt(), config.get("TurretRocket", "Accuracy", 10, "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.").getDouble(), config.get("TurretRocket", "PowerUsage", 5000, "RF used per shot").getInt(), config.get("TurretRocket", "Enabled", true, "Enabled?").getBoolean(), config.get("TurretRocket", "DamageAmpBonus", 0.08F, "Value of the bonus damage (relative to HP of enemy target) for the turret per damage amp addon.").getDouble());
    teleporter_turret = new TurretSetting(config.get("TurretTeleporter", "Range", 20, "Turret range, in blocks").getInt(), config.get("TurretTeleporter", "FireRateCooldown", 100, "Number of ticks between firings").getInt(), config.get("TurretTeleporter", "Damage", 0, "Measured in half-hearts").getInt(), config.get("TurretTeleporter", "Accuracy", 0, "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.").getDouble(), config.get("TurretTeleporter", "PowerUsage", 15000, "RF used per shot").getInt(), config.get("TurretTeleporter", "Enabled", true, "Enabled?").getBoolean(), 0);
    laser_turret = new TurretSetting(config.get("TurretLaser", "Range", 25, "Turret range, in blocks").getInt(), config.get("TurretLaser", "FireRateCooldown", 10, "Number of ticks between firings").getInt(), config.get("TurretLaser", "Damage", 2, "Measured in half-hearts").getInt(), config.get("TurretLaser", "Accuracy", 10, "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.").getDouble(), config.get("TurretLaser", "PowerUsage", 10000, "RF used per shot").getInt(), config.get("TurretLaser", "Enabled", true, "Enabled?").getBoolean(), config.get("TurretLaser", "DamageAmpBonus", 0.06F, "Value of the bonus damage (relative to HP of enemy target) for the turret per damage amp addon.").getDouble());
    railgun_turret = new TurretSetting(config.get("TurretRailgun", "Range", 30, "Turret range, in blocks").getInt(), config.get("TurretRailgun", "FireRateCooldown", 100, "Number of ticks between firings").getInt(), config.get("TurretRailgun", "Damage", 25, "Measured in half-hearts").getInt(), config.get("TurretRailgun", "Accuracy", 0, "Value between 0 - 100, where 0 will miss 0% of the time over a distance of 10 blocks, subject to standard deviation.").getDouble(), config.get("TurretRailgun", "PowerUsage", 25000, "RF used per shot").getInt(), config.get("TurretRailgun", "Enabled", true, "Enabled?").getBoolean(), config.get("TurretRailgun", "DamageAmpBonus", 0.10F, "Value of the bonus damage (relative to HP of enemy target) for the turret per damage amp addon.").getDouble());
    rangeUpgradeBoost = config.get("upgrades", "range", 2, "Increases range in blocks linearly").getInt();
    fireRateUpgradeBoostPercentage = config.get("upgrades", "rateOfFire", 0.1D, "It's a double for some reason, reduces cooldown").getDouble();
    accuracyUpgradeBoost = config.get("upgrades", "accuracy", 0.2D, "Increases accuracy linearly").getDouble();
    efficiencyUpgradeBoostPercentage = config.get("upgrades", "efficiency", 0.08D, "Reduces power consumption linearly").getDouble();
    solarPanelAddonGen = config.get("addons", "solar", 10, "Generates specified RF every tick in sunlight").getInt();
    redstoneReactorAddonGen = config.get("addons", "redstone", 1550, "Generates RF from redstone dust/blocks in turret's inventory").getInt();
    recyclerNegateChance = config.get("addons", "recycler", 10, "Recycler ammo use negation % chance").getInt();
    recyclerAddChance = config.get("addons", "recycler", 5, "Recycler ammo add % chance").getInt();
    turretWarningDistance = config.get("miscellaneous", "warningDistance", 5, "Distance outside the max range of a turret players should be warned").getInt();
    turretAlarmSound = config.get("miscellaneous", "Enable/Disable turret alarm sound. True=enabled, false=disabled", true).getBoolean();
    turretWarnMessage = config.get("miscellaneous", "Should turret warn message be displayed?", true).getBoolean();
    turretBreakable = config.get("miscellaneous", "Are turrets/turret bases breakable by anyone?", false).getBoolean();
    turretDamageTrustedPlayers = config.get("miscellaneous", "Can turrets damage their trusted players when they accidentally hit them?", true).getBoolean();
    canRocketsHome = config.get("miscellaneous", "Can rockets fired by the rocket launcher turret home on targets ?", false).getBoolean();
    doTurretsKillsDropMobLoot = config.get("miscellaneous", "Do Mobs killed by turrets drop loot?", true).getBoolean();
    useWhitelistForAmmo = config.get("miscellaneous", "whitelistForAmmo", true, "Use Whitelist for ammo slots?").getBoolean();
    stringMobBlackList = Arrays.asList(config.getStringList("mobBlackList", "miscellaneous", new String[] { "ArmorStand" }, "Which Entities should not be targetable by turrets? String is the name used by the /summon command."));
    stringAmmoAllowList = Arrays.asList(config.getStringList("disposableAmmoList", "miscellaneous", new String[] { "minecraft:cobblestone", "minecraft:planks" }, "Which Items should be usable as disp. ammo (modid:itemname[:meta], if meta is omitted it enables all subitems/blocks)"));
    canRocketsHurtEnderDragon = config.get("miscellaneous", "Can rockets fired by the rocket launcher turret hurt the Ender Dragon?", false).getBoolean();
    recipes = config.get("miscellaneous", "Which recipes should we do? (auto, enderio, mekanism, vanilla)", "auto").getString();
    turretSoundVolume = config.get("miscellaneous", "Turret sound volume percentage (Between 0 - 100)", 40).getInt() / 10;
    allowBaseCamo = config.get("miscellaneous", "Should turret bases be camouflage-able with normal blocks?", true).getBoolean();
    canRocketsDestroyBlocks = config.get("miscellaneous", "Can rockets destroy normal blocks?", false).getBoolean();
    canGrenadesDestroyBlocks = config.get("miscellaneous", "Can grenades destroy normal blocks?", false).getBoolean();
    canRailgunDestroyBlocks = config.get("miscellaneous", "Can the railgun destroy normal blocks?", false).getBoolean();
    shouldDoThaumcraftIntegration = config.get("ModCompatibility", "Should we enable items that integrate with Thaumcraft?", true).getBoolean();
    potentiaToRFRatio = config.get("ModCompatibility", "Potentia Addons' RF conversion ratio per 1 essentia", 500).getInt();
    potentiaAddonCapacity = config.get("ModCompatibility", "How much essentia the Potentia Addon can store", 20).getInt();
    globalCanTargetPlayers = config.get("GlobalTargetingParameters", "Can turrets attack players?", true).getBoolean();
    globalCanTargetNeutrals = config.get("GlobalTargetingParameters", "Can turrets attack neutrals?", true).getBoolean();
    globalCanTargetMobs = config.get("GlobalTargetingParameters", "Can turrets attack mobs?", true).getBoolean();
    expanderPowerTierOneCapacity = config.get("Expanders", "Power expander tier one capacity", 250).getInt();
    expanderPowerTierTwoCapacity = config.get("Expanders", "Power expander tier two capacity", 25000).getInt();
    expanderPowerTierThreeCapacity = config.get("Expanders", "Power expander tier three capacity", 75000).getInt();
    expanderPowerTierFourCapacity = config.get("Expanders", "Power expander tier four capacity", 250000).getInt();
    expanderPowerTierFiveCapacity = config.get("Expanders", "Power expander tier five capacity", 5000000).getInt();
    turretTargetSearchTicks = config.get("GlobalTargetingParameters", "If a turret does not have a target, how many ticks should it wait before looking again?", 10).getInt();
    if (config.hasChanged()) {
        config.save();
    }
}
Also used : Configuration(net.minecraftforge.common.config.Configuration)

Aggregations

Configuration (net.minecraftforge.common.config.Configuration)39 File (java.io.File)14 EventHandler (net.minecraftforge.fml.common.Mod.EventHandler)5 EventHandler (cpw.mods.fml.common.Mod.EventHandler)4 IOException (java.io.IOException)2 Property (net.minecraftforge.common.config.Property)2 ModMetadata (net.minecraftforge.fml.common.ModMetadata)2 AgriConfigAdapter (com.agricraft.agricore.config.AgriConfigAdapter)1 WorldConversionEventHandler (com.bluepowermod.convert.WorldConversionEventHandler)1 BPEventHandler (com.bluepowermod.event.BPEventHandler)1 Config (com.bluepowermod.init.Config)1 RedstoneProviderQmunityLib (com.bluepowermod.redstone.RedstoneProviderQmunityLib)1 ProxyASMTest (com.builtbroken.mc.core.asm.ProxyASMTest)1 ItemDevData (com.builtbroken.mc.core.content.debug.ItemDevData)1 ItemInstaHole (com.builtbroken.mc.core.content.debug.ItemInstaHole)1 TileInfInv (com.builtbroken.mc.core.content.debug.TileInfInv)1 ItemScrewdriver (com.builtbroken.mc.core.content.tool.ItemScrewdriver)1 ItemSelectionWand (com.builtbroken.mc.core.content.tool.ItemSelectionWand)1 ToolModeGeneral (com.builtbroken.mc.core.content.tool.screwdriver.ToolModeGeneral)1 ToolModeRotation (com.builtbroken.mc.core.content.tool.screwdriver.ToolModeRotation)1