public static void init(File configFile) {
    config = new Configuration(configFile);

    try {
      config.load();

      generateEmeralds = config.getBoolean("Generate Emeralds", "World Gen", true, "");

      enableCobblestoneBoulders =
          config.getBoolean("Enable Cobblestone Boulders", "World Gen", true, "");
      cobblestoneBoulderChance =
          config.getInt(
              "1/x chance that Cobblestone Boulders will generate if given the opportunity to do so during world gen",
              "World Gen",
              1,
              1,
              100,
              "1 = Always generate if possible; 2 = 50% chance; 4 = 25% chance");

      showDebugInfo = config.getBoolean("Show Debug Info in F3 Screen", "Debugging", false, "");
      enableDebugging =
          config.getBoolean(
              "Enable Debugging",
              "Debugging",
              false,
              "WARNING: This should only be enabled if you know what you're doing.");

      biomeSize =
          config.getInt(
              "Size of Biomes",
              "World Gen",
              4,
              4,
              6,
              "COMING SOON!!! 4 = Default World Type; 6 = Large Biomes World Type");
    } catch (Exception e) {
      FMLLog.log(Level.ERROR, e, "RTG has had a problem loading RTG configuration.");
    } finally {
      if (config.hasChanged()) {
        config.save();
      }
    }
  }
  private static void loadConfiguration() {
    dimensionId =
        configuration.getInt(
            "dimension",
            "Internal",
            -1,
            Integer.MIN_VALUE,
            Integer.MAX_VALUE,
            "Dimension used for machines. Do not change this unless it is somehow conflicting!");
    maxDroppedStacks =
        configuration.getInt(
            "maxDroppedStacks",
            "CompactMachines",
            128,
            0,
            Integer.MAX_VALUE,
            "Maximum number of items dropping when breaking a Compact Machine");

    if (configuration.hasChanged()) {
      configuration.save();
    }
  }
Beispiel #3
0
 public static void initClient(FMLPreInitializationEvent evt) {
   Configuration c =
       new Configuration(
           new File(
               evt.getModConfigurationDirectory(),
               Questlog.modID
                   + File.separator
                   + Questlog.modID.toLowerCase(Locale.ENGLISH)
                   + ".cfg"));
   try {
     c.load();
     questlogXPos = c.getInt("Questlog X Position", "Client", 10, 0, 10000, "");
     questlogYPos = c.getInt("Questlog Y Position", "Client", 10, 0, 10000, "");
   } catch (Exception e) {
     Questlog.logger.warn("Could not load the config file");
     e.printStackTrace();
   } finally {
     c.save();
   }
 }
 /** Configを同期する。 */
 public static void syncConfig() {
   String separator = System.lineSeparator();
   String restart = separator + "Please restart Minecraft to reflect this setting." + separator;
   try {
     // General
     isUpdateCheckEnabled =
         cfg.getBoolean(
             "enabledUpdateCheck",
             GENERAL,
             isUpdateCheckEnabled,
             "Update Check is valid when true." + restart);
     efficiencyPerfectTool =
         cfg.getFloat(
             "efficiencyPerfectTool",
             GENERAL,
             efficiencyPerfectTool,
             1,
             Float.MAX_VALUE,
             "Efficiency of Ofalen Perfect Tool." + restart);
     sizeExplosion =
         (byte)
             cfg.getInt(
                 "sizeExplosion",
                 GENERAL,
                 sizeExplosion,
                 0,
                 Byte.MAX_VALUE,
                 "Explosion size of Explosion Ball.");
     // Difficulty
     amountDrop =
         (byte)
             cfg.getInt(
                 "amountDrop",
                 DIFFICULTY,
                 amountDrop,
                 1,
                 Byte.MAX_VALUE,
                 "Drop amount of Ofalen Fragment from Ofalen Ore.");
     // Generate
     isGeneratorEnabled =
         cfg.getBoolean(
             "enabledGenerator",
             GENERATE,
             isGeneratorEnabled,
             "Ofalen Ore will be generated when true.");
     limitGeneration =
         (byte)
             cfg.getInt(
                 "limitGeneration",
                 GENERATE,
                 limitGeneration,
                 1,
                 Byte.MAX_VALUE,
                 "Maximum generation size of Ofalen Ore.");
     frequencyGeneration =
         (byte)
             cfg.getInt(
                 "GenerationFrequency",
                 GENERATE,
                 frequencyGeneration,
                 1,
                 Byte.MAX_VALUE,
                 "Generation Frequency of Ofalen Ore.");
     probabilityLodeGeneration =
         (short)
             cfg.getInt(
                 "probabilityLodeGeneration",
                 GENERATE,
                 probabilityLodeGeneration,
                 1,
                 10000,
                 "Generation probability of Huge Ofalen Ore Lode.(/10000)");
     // Machine
     factorFurnaceFuelBurningTime =
         (short)
             cfg.getInt(
                 "factorFurnaceFuelBurningTime",
                 MACHINE,
                 factorFurnaceFuelBurningTime,
                 1,
                 Short.MAX_VALUE,
                 "Burning time factor of furnace fuel.");
     timeStoneFuelBurning =
         (short)
             cfg.getInt(
                 "timeStoneFuelBurning",
                 MACHINE,
                 timeStoneFuelBurning,
                 1,
                 Short.MAX_VALUE,
                 "Burning time of Stone Fuel.(tick)");
     timeOfalenFuelBurning =
         (short)
             cfg.getInt(
                 "timeOfalenFuelBurning",
                 MACHINE,
                 timeOfalenFuelBurning,
                 1,
                 Short.MAX_VALUE,
                 "Burning time of Ofalen Fuel.(tick)");
     timeSmelting =
         (short)
             cfg.getInt(
                 "timeSmelting",
                 MACHINE,
                 timeSmelting,
                 1,
                 Short.MAX_VALUE,
                 "Working time of Ofalen Smelting Machine.(tick)");
     timeConverting =
         (short)
             cfg.getInt(
                 "timeConverting",
                 MACHINE,
                 timeConverting,
                 1,
                 Short.MAX_VALUE,
                 "Working time of Ofalen Converting Machine.(tick)");
     timeRepairing =
         (short)
             cfg.getInt(
                 "timeRepairing",
                 MACHINE,
                 timeRepairing,
                 1,
                 Short.MAX_VALUE,
                 "Working time of Ofalen Repairing Machine.(tick)");
     timeFusing =
         (short)
             cfg.getInt(
                 "timeFusing",
                 MACHINE,
                 timeFusing,
                 1,
                 Short.MAX_VALUE,
                 "Working time of Ofalen Fusing Machine.(tick)");
     baseOfalenSmeltingAmount =
         (byte)
             cfg.getInt(
                 "baseOfalenSmeltingAmount",
                 MACHINE,
                 baseOfalenSmeltingAmount,
                 1,
                 64,
                 "Smelting amount of Ofalen Smelting Machine from Ofalen Ore to Ofalen."
                     + restart);
     // Recipe
     blankLumpRecipe =
         (byte)
             cfg.getInt(
                 "blankLumpRecipe",
                 RECIPE,
                 blankLumpRecipe,
                 0,
                 8,
                 "Recipe of \"Lump of Stone\". Number is location of space."
                     + separator
                     + "0 1 2"
                     + separator
                     + "3 4 5"
                     + separator
                     + "6 7 8"
                     + restart);
     amountShieldIngotRecipe =
         (byte)
             cfg.getInt(
                 "amountShieldIngotRecipe",
                 RECIPE,
                 amountShieldIngotRecipe,
                 1,
                 64,
                 "Amount of Ofalen Shield Ingot when made by normal recipe." + restart);
     amountTeleportPearlRecipe =
         (byte)
             cfg.getInt(
                 "amountTeleportPearlRecipe",
                 RECIPE,
                 amountTeleportPearlRecipe,
                 1,
                 64,
                 "Amount of Ofalen Teleport Pearl when made by normal recipe." + restart);
     amountFloatDustRecipe =
         (byte)
             cfg.getInt(
                 "amountFloatDustRecipe",
                 RECIPE,
                 amountFloatDustRecipe,
                 1,
                 64,
                 "Amount of Ofalen Float Dust when made by normal recipe." + restart);
     amountCollectingLampRecipe =
         (byte)
             cfg.getInt(
                 "amountCollectingLampRecipe",
                 RECIPE,
                 amountCollectingLampRecipe,
                 1,
                 64,
                 "Amount of Ofalen Collecting Dust when made by normal recipe." + restart);
     // Future
     amountShieldDamage =
         (short)
             cfg.getInt(
                 "amountShieldDamage",
                 FUTURE,
                 amountShieldDamage,
                 0,
                 64 * 9,
                 "Damage amount of Ofalen Shield when protect player.");
     amountTeleporterDamage =
         (short)
             cfg.getInt(
                 "amountTeleporterDamage",
                 FUTURE,
                 amountTeleporterDamage,
                 0,
                 64,
                 "Damage amount of Ofalen Teleporter when teleport player.");
     amountFloaterDamage =
         (short)
             cfg.getInt(
                 "amountFloaterDamage",
                 FUTURE,
                 amountFloaterDamage,
                 0,
                 64 * 9,
                 "Damage amount of Ofalen Floater when float player.");
     amountCollectorDamageItem =
         (short)
             cfg.getInt(
                 "amountCollectorDamageItem",
                 FUTURE,
                 amountCollectorDamageItem,
                 0,
                 64 * 9,
                 "Damage amount of Ofalen Collector when collect item.");
     amountCollectorDamageExp =
         (short)
             cfg.getInt(
                 "amountCollectorDamageExp",
                 FUTURE,
                 amountCollectorDamageExp,
                 0,
                 64 * 9,
                 "Damage amount of Ofalen Collector when collect experience orb.");
     intervalFloaterDamage =
         (byte)
             cfg.getInt(
                 "intervalFloaterDamage",
                 FUTURE,
                 intervalFloaterDamage,
                 0,
                 Byte.MAX_VALUE,
                 "Damage interval of Ofalen Floater.(tick)");
   } catch (Exception e) {
     OfalenLog.error("Error on loading config.", "OfalenModConfigCore");
   } finally {
     cfg.save();
   }
 }
  public static void syncConfig() {
    file.setCategoryRequiresMcRestart(categoryVanillaTabs, true);
    shouldOverrideBuildingBlocksTab =
        file.getBoolean(
            "Custom Building Blocks Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Building Blocks tab and sort it.");
    shouldOverrideDecorationsTab =
        file.getBoolean(
            "Custom Decorations Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Decorations tab and sort it.");
    shouldOverrideRedstoneTab =
        file.getBoolean(
            "Custom Redstone Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Redstone tab and sort it.");
    shouldOverrideTransportationTab =
        file.getBoolean(
            "Custom Transportation Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Transportation tab and sort it.");
    shouldOverrideMiscTab =
        file.getBoolean(
            "Custom Misc Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Misc tab and sort it.");
    shouldOverrideFoodTab =
        file.getBoolean(
            "Custom Food Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Food tab and sort it.");
    shouldOverrideToolsTab =
        file.getBoolean(
            "Custom Tool Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Tools tab and sort it.");
    shouldOverrideCombatTab =
        file.getBoolean(
            "Custom Combat Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Combat tab and sort it.");
    shouldOverrideBrewingTab =
        file.getBoolean(
            "Custom Brewing Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Brewing tab and sort it.");
    shouldOverrideMaterialTab =
        file.getBoolean(
            "Custom Material Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Materials tab and sort it.");
    shouldOverrideSearchTab =
        file.getBoolean(
            "Custom Search Tab",
            categoryVanillaTabs,
            true,
            "Choose if Quality Order should override the Search tab - this uses Reflection.");

    file.setCategoryRequiresMcRestart(categoryQualityTabs, true);
    shouldAddUnavailableTab =
        file.getBoolean(
            "Unavailable Tab",
            categoryQualityTabs,
            true,
            "Choose if Quality Order's Unavailable tab should be enabled.");
    shouldAddSkullsTab =
        file.getBoolean(
            "Skulls Tab",
            categoryQualityTabs,
            true,
            "Choose if Quality Order's Skulls tab should be enabled.");
    shouldAddBannersTab =
        file.getBoolean(
            "Embroidery Tab",
            categoryQualityTabs,
            true,
            "Choose if Quality Order's Embroidery tab should be enabled.");
    shouldAddThievingTab =
        file.getBoolean(
            "Thieving Tab",
            categoryQualityTabs,
            true,
            "Choose if Quality Order's Thieving tab should be enabled.");
    shouldAddFireworkTab =
        file.getBoolean(
            "Firework Tab",
            categoryQualityTabs,
            true,
            "Choose if Quality Order's Firework tab should be enabled.");
    shouldAddArmorStandTab =
        file.getBoolean(
            "Armor Stands Tab",
            categoryQualityTabs,
            true,
            "Choose if Quality Order's Armor Stands tab should be enabled.");
    shouldAddMapTab =
        file.getBoolean(
            "Cartography Tab",
            categoryQualityTabs,
            true,
            "Choose if Quality Order's Cartography tab should be enabled.");
    shouldAddDeathTab =
        file.getBoolean(
            "Death Tab",
            categoryQualityTabs,
            true,
            "Choose if Quality Order's Death tab should be enabled.");
    shouldAddMemoryTab =
        file.getBoolean(
            "Contained Memory Tab",
            categoryQualityTabs,
            true,
            "Choose if Quality Order's Contained Memory tab should be enabled.");

    file.setCategoryRequiresMcRestart(categoryQualityTabSettings, false);
    cartographyNumberOfMaps =
        file.getInt(
            "Cartography - Max Number of Maps",
            categoryQualityTabSettings,
            cartographyNumberOfMaps,
            0,
            30000,
            "Select the number of maps that should be on the Cartography tab. You can also disable it, if you don't want the tab at all.");
    cartographyRemoveUnknownMaps =
        file.getBoolean(
            "Cartography - Remove Unknown Maps",
            categoryQualityTabSettings,
            cartographyRemoveUnknownMaps,
            "Choose if unknown maps should be included (false) or not (true)");
    thievingRange =
        file.getInt(
            "Thieving - Range",
            categoryQualityTabSettings,
            thievingRange,
            1,
            100,
            "How close you need to be to Copy somebody's items. If you don't want this feature, you can disable the tab.");
    skullsRange =
        file.getInt(
            "Skulls - Range",
            categoryQualityTabSettings,
            skullsRange,
            0,
            100,
            "Select the range of nearby players to get the skulls of. 0 will disable the feature.");
    skullsList =
        file.getStringList(
            "Skulls - List",
            categoryQualityTabSettings,
            skullsList,
            "A list containing usernames of players whose skull should be added to the Skulls tab.");
    skullsMhfSkulls =
        file.getBoolean(
            "Skulls - Enable MHF_Skulls",
            categoryQualityTabSettings,
            true,
            "Should the skulls tab contain MHF skulls?");

    if (file.hasChanged()) {
      file.save();
    }
  }
  public void load(File file) {
    Configuration config = new Configuration(file, String.valueOf(VERSION));
    config.setCategoryComment(
        GAMEPLAY,
        "These settings will affect how the mod behaves in certain situations and the players' overall gameplay,\n"
            + "but generally won't affect performance.");
    config.setCategoryComment(
        INTERFACE, "These setting will affect the look and feel of the Atlas' interface.");
    config.setCategoryComment(
        PERFORMANCE,
        "These settings affect the algorithms for scanning the world, drawing the map etc. Changing them may\n"
            + "improve the game's overall stability and performance at the cost of Atlas' functionality.");

    doSaveBrowsingPos =
        config.getBoolean(
            "do_save_browsing_pos",
            GAMEPLAY,
            doSaveBrowsingPos,
            "Whether to remember last open browsing position and zoom level for each dimension in every atlas.\n"
                + "If disabled, all dimensions and all atlases will be \"synchronized\" at the same coordinates and\n"
                + "zoom level, and map will \"follow\" player by default.");
    autoDeathMarker =
        config.getBoolean(
            "auto_death_marker",
            GAMEPLAY,
            autoDeathMarker,
            "Whether to add local marker for the spot where the player died.");
    autoVillageMarkers =
        config.getBoolean(
            "auto_village_markers",
            GAMEPLAY,
            autoVillageMarkers,
            "Whether to add global markers for NPC villages.");

    defaultScale =
        config.getFloat(
            "default_scale",
            INTERFACE,
            defaultScale,
            (float) GuiAtlas.MIN_SCALE,
            (float) GuiAtlas.MAX_SCALE,
            "Default zoom level. The number corresponds to the size of a block on the map relative to the size of\n"
                + "a GUI pixel.");
    doScaleMarkers =
        config.getBoolean(
            "do_scale_markers",
            INTERFACE,
            doScaleMarkers,
            "Whether to change markers size depending on zoom level.");

    scanRadius =
        config.getInt(
            "area_scan_radius",
            PERFORMANCE,
            scanRadius,
            1,
            256,
            "The radius of the area around the player which is scanned by the Atlas at regular intervals.\n"
                + "Note that this will not force faraway chunks to load, unless force_chunk_loading is enabled.\n"
                + "Lower value gives better performance.");
    forceChunkLoading =
        config.getBoolean(
            "force_chunk_loading",
            PERFORMANCE,
            forceChunkLoading,
            "Force loading of chunks within scan radius even if it exceeds regular chunk loading distance.\n"
                + "Enabling this may SEVERELY decrease performance!");
    newScanInterval =
        config.getFloat(
            "area_scan_interval",
            PERFORMANCE,
            newScanInterval,
            1f / 20f,
            3600,
            "Time in seconds between two scans of the area.\nHigher value gives better performance.");
    doRescan =
        config.getBoolean(
            "do_rescan",
            PERFORMANCE,
            doRescan,
            "Whether to rescan chunks in the area that have been previously mapped. This is useful in case of\n"
                + "changes in coastline (including small ponds of water and lava), or if land disappears completely\n"
                + "(for sky worlds).\nDisable for better performance.");
    rescanRate =
        config.getInt(
            "area_rescan_rate",
            PERFORMANCE,
            rescanRate,
            1,
            1000,
            "The number of area scans between full rescans.\nHigher value gives better performance.");
    doScanPonds =
        config.getBoolean(
            "do_scan_ponds",
            PERFORMANCE,
            doScanPonds,
            "Whether to perform additional scanning to locate small ponds of water or lava.\nDisable for better performance.");

    config.save();
  }
  private static void loadConfig() {
    ConfigSettings.VanillaChestConversion =
        config.getBoolean(
            "VanillaChestConversion",
            Configuration.CATEGORY_GENERAL,
            true,
            "Enable vanilla chest conversion: ");

    ConfigSettings.FleshBlockRecipe =
        config.getBoolean(
            "FleshBlockRecipe",
            Configuration.CATEGORY_GENERAL,
            false,
            "Enable Steamcraft 2 Flesh Block Recipe: ");

    ConfigSettings.FSPBoilerWaterFix =
        config.getBoolean(
            "FSPBoilerWaterFix",
            Configuration.CATEGORY_GENERAL,
            true,
            "Enable Flaxbeard's Steam Power Boiler TFC water fix: ");

    ConfigSettings.FSPFlashBoilerWaterFix =
        config.getBoolean(
            "FSPFlashBoilerWaterFix",
            Configuration.CATEGORY_GENERAL,
            true,
            "Enable Flaxbeard's Steam Power Flash Boiler TFC water fix: ");

    ConfigSettings.FSPWailaIntegration =
        config.getBoolean(
            "FSPWailaIntegration",
            Configuration.CATEGORY_GENERAL,
            true,
            "Enable Flaxbeard's Steam Power Waila integration: ");

    ConfigSettings.VanillaMagicScaling =
        config.getBoolean(
            "EnableVanillaMagicScaling",
            "MagicScaling",
            true,
            "Enable vanilla magic damage to TFC scaling: ");

    ConfigSettings.VanillaMagicMultipier =
        config.getInt(
            "VanillaMagicMultipier",
            "MagicScaling",
            25,
            1,
            1000,
            "Multiplier used to scale vanilla magic damage to TFC levels: ");

    ConfigSettings.FiniteMagicDamageCutoff =
        config.getBoolean(
            "EnableFiniteMagicDamageCutoff",
            "MagicScaling.CutOff",
            true,
            "Enable magic cutoff damage at specific value: ");

    ConfigSettings.FiniteMagicDamageCutoffValue =
        config.getInt(
            "FiniteMagicDamageCutoffValue",
            "MagicScaling.CutOff",
            0,
            0,
            1000,
            "Value to stop applying magic damage if EnableFiniteMagicDamageCutoff is true: ");

    ConfigSettings.PercentMagicDamageCutoffValue =
        config.getInt(
            "PercentMagicDamageCutoffValue",
            "MagicScaling.CutOff",
            10,
            0,
            100,
            "Percent health to stop applying magic damage if EnableFiniteMagicDamageCutoff is false: ");

    ConfigSettings.VanillaDamageScaling =
        config.getBoolean(
            "EnableVanillaDamageScaling",
            "HitScaling",
            true,
            "Enable vanilla hit damage to TFC scaling: ");

    ConfigSettings.VanillaPvPDamageScaling =
        config.getBoolean(
            "EnableVanillaPvPDamageScaling",
            "HitScaling.PvP",
            true,
            "Enable vanilla PvP hit damage to TFC scaling: ");

    ConfigSettings.VanillaPvPNonWeaponDamageMultipier =
        config.getInt(
            "VanillaPvPNonWeaponDamageMultipier",
            "HitScaling.PvP",
            10,
            1,
            1000,
            "Multiplier used to scale vanilla PvP non-weapon hit damage to TFC levels: ");

    ConfigSettings.VanillaPvPWeaponDamageMultipier =
        config.getInt(
            "VanillaPvPWeaponDamageMultipier",
            "HitScaling.PvP",
            25,
            1,
            1000,
            "Multiplier used to scale vanilla PvP weapon hit damage to TFC levels: ");

    ConfigSettings.VanillaMobDamageScaling =
        config.getBoolean(
            "EnableVanillaMobDamageScaling",
            "HitScaling.mob",
            true,
            "Enable vanilla mob hit damage to TFC scaling: ");

    ConfigSettings.VanillaMobDamageMultipier =
        config.getInt(
            "VanillaMobDamageMultipier",
            "HitScaling.mob",
            50,
            1,
            1000,
            "Multiplier used to scale vanilla mob hit damage to TFC levels: ");

    ConfigSettings.InstantHealingScaling =
        config.getBoolean(
            "EnableInstantHealingScaling",
            "HealScaling",
            true,
            "Enable vanilla instant healing potion to TFC scaling: ");

    ConfigSettings.VanillaHealingMultipier =
        config.getInt(
            "VanillaHealingMultipier",
            "HealScaling",
            50,
            10,
            1000,
            "Multiplier used to scale vanilla instant healing potion to TFC levels: ");

    ConfigSettings.MineTweakerSupport =
        config.getBoolean(
            "MineTweakerSupport",
            Configuration.CATEGORY_GENERAL,
            true,
            "Enable Minetweaker support for TFC: ");

    if (config.hasChanged()) config.save();
  }