コード例 #1
0
 /** 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();
   }
 }
コード例 #2
0
  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();
  }