Package net.minecraftforge.common.config

Examples of net.minecraftforge.common.config.Property


            for (int i = 0; i < values.length; i++)
            {
                values[i] = String.valueOf(ConfigManagerCore.staticLoadDimensions[i]);
            }

            Property prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Static Loaded Dimensions", ConfigManagerCore.staticLoadDimensions);
            prop.comment = "IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded";
            prop.setLanguageKey("gc.configgui.staticLoadedDimensions");
            prop.set(values);

            ConfigManagerCore.config.save();
        }

        return !found;
View Full Code Here


            for (int i = 0; i < values.length; i++)
            {
                values[i] = String.valueOf(ConfigManagerCore.staticLoadDimensions[i]);
            }

            Property prop = config.get(Constants.CONFIG_CATEGORY_DIMENSIONS, "Static Loaded Dimensions", ConfigManagerCore.staticLoadDimensions);
            prop.comment = "IDs to load at startup, and keep loaded until server stops. Can be added via /gckeeploaded";
            prop.setLanguageKey("gc.configgui.staticLoadedDimensions");
            prop.set(values);

            ConfigManagerCore.config.save();
        }

        return foundCount > 0;
View Full Code Here

        {
            optionalConfig = Optional.of(new EnhancedConfiguration(configFile));
            final EnhancedConfiguration configuration = optionalConfig.get();
           
      // version section
            Property configVersion;
      if (configuration.hasKey(EnhancedConfiguration.CATEGORY_VERSION, "configFileVersoin")) {
        // handle legacy typoed option
        configVersion = configuration.get(EnhancedConfiguration.CATEGORY_VERSION, "configFileVersoin", "");
      } else {
        configVersion = configuration.get(EnhancedConfiguration.CATEGORY_VERSION, "configFileVersion", "");
      }
      configVersion.comment = "To help ebxl in updating the config file in the future.";

      // for future use - are we upgrading between config versions?
      final boolean isNewVersion = !configVersion.getString().equals(Reference.CONFIG_VERSION);
      configVersion.set(Reference.CONFIG_VERSION);

      Property upgradeProp = configuration.get("version", "upgrade", upgradeOverride);
      upgradeProp.comment = "Should new (game changing) features be automatically enabled?";
      boolean autoUpgrade = upgradeProp.getBoolean(false);

      // load general config settings

            for (final BiomeSettings setting : BiomeSettings.values())
            {
                setting.load(configuration);
            }
           
            for (final DecorationSettings setting : DecorationSettings.values())
            {
                setting.load(configuration);
            }
           
            for (final BlockSettings setting : BlockSettings.values())
            {
                setting.load(configuration, upgradeOverride);
            }
           
            for (final ItemSettings setting : ItemSettings.values())
            {
                setting.load(configuration, upgradeOverride);
            }
           
            configuration.addCustomCategoryComment("saplingreplanting", "Settings to configure the chance that saplings will replant themselves up despawning on valid soil.");
            for (final SaplingSettings setting : SaplingSettings.values())
            {
                setting.load(configuration);
            }
           
            for (final ModuleControlSettings setting : ModuleControlSettings.values())
            {
                setting.load(configuration);
            }
           
            configuration.addCustomCategoryComment(EnhancedConfiguration.CATEGORY_NEWDAWN, "New Dawn biome size hints.");
            for (final NewDawnSettings setting : NewDawnSettings.values())
            {
                setting.load(configuration);
            }
           
            Property bigTreeSaplingDropRateProperty = configuration.get(Configuration.CATEGORY_GENERAL, "Relative sapling drops", GeneralSettings.bigTreeSaplingDropModifier);
            bigTreeSaplingDropRateProperty.comment = "Setting relative sapling drops to true will decrease the amount of saplings dropped by decaying fir and redwood leaf blocks to a more reasonable amount.";
            GeneralSettings.bigTreeSaplingDropModifier = bigTreeSaplingDropRateProperty.getBoolean(false);
           
            //
            Property consoleCommandsDisabled = configuration.get(Configuration.CATEGORY_GENERAL, "DisableConsoleCommands", GeneralSettings.consoleCommandsDisabled);
            consoleCommandsDisabled.comment = "Set to false to enable console commands.";
            GeneralSettings.consoleCommandsDisabled = consoleCommandsDisabled.getBoolean(true);

            Property useLegacyRedwoods = configuration.get(Configuration.CATEGORY_GENERAL, "UseLegacyRedwoods", autoUpgrade ? true : GeneralSettings.useLegacyRedwoods);
            useLegacyRedwoods.comment = "Set to true to enable old redwood tree generation.";
            GeneralSettings.useLegacyRedwoods = useLegacyRedwoods.getBoolean(false);

            Property useMC18Doors = configuration.get(Configuration.CATEGORY_GENERAL, "UseMC18Doors", GeneralSettings.useMC18Doors);
            useMC18Doors.comment = "Allow EbXL doors to stack like in MC 1.8 and be crafted in stacks of 3.";
            GeneralSettings.useMC18Doors = useMC18Doors.getBoolean(true);
           
            //GeneralSettings.consoleCommandsDisabled = consoleCommandsDisabled.getBoolean(true);
           
        }
        catch (final Exception e)
View Full Code Here

     * Gets or create a biome id property. If the biome id property key is already in the configuration, then it will be used. Otherwise,
     * defaultId will be used, except if already taken, in which case this will try to determine a free default id.
     */
    public Property getBiome(String category, String key, int defaultID)
    {
        final Property prop = get(category, key, defaultID);
       
        if (prop.getInt() == -1)
        {
            //configBiomes[prop.getInt()] = true;
            return prop;
        }
       
        if (BiomeGenBase.getBiomeGenArray()[prop.getInt()] == null && !configBiomes[prop.getInt()])
        {
            prop.set(Integer.toString(prop.getInt()));
            configBiomes[prop.getInt()] = true;
            return prop;
        }
       
        if(configBiomes[prop.getInt()]) {
          LogHelper.warning("Warning two of Extrabiomes were set to Biome ID #%d in your config file.", prop.getInt());
        } else if(prop.getInt() != defaultID) {
          String msg = "Warning biome ID conflict.\n";
          msg += "According to ExtrabiomesXL's config file, biome id #%d was used by %s, but it has been overwritten by %s.\n";
          msg += "Any existing worlds may have incorrect biome information.";
          LogHelper.warning(msg, prop.getInt(), key, BiomeGenBase.getBiomeGenArray()[prop.getInt()].getBiomeClass().getName() + ":" + BiomeGenBase.getBiomeGenArray()[prop.getInt()].biomeName);
        }
       
        for (int j = 40; j < configBiomes.length - 1; j++) {
            if (BiomeGenBase.getBiomeGenArray()[j] == null && !configBiomes[j]) {
                prop.set(Integer.toString(j));
                configBiomes[j] = true;
                return prop;
            }
        }
       
View Full Code Here

  }

  public boolean renameProperty(String category, String key, String newCategory, String newKey, boolean forceValue) {

    if (modConfiguration.hasKey(category, key)) {
      Property prop = modConfiguration.getCategory(category).get(key);

      if (prop.isIntValue()) {
        int value = modConfiguration.getCategory(category).getValues().get(key).getInt();
        removeProperty(category, key);

        if (forceValue) {
          removeProperty(newCategory, newKey);
        }
        modConfiguration.get(newCategory, newKey, value);
      } else if (prop.isBooleanValue()) {
        boolean value = modConfiguration.getCategory(category).getValues().get(key).getBoolean(false);
        removeProperty(category, key);

        if (forceValue) {
          removeProperty(newCategory, newKey);
        }
        modConfiguration.get(newCategory, newKey, value);
      } else if (prop.isDoubleValue()) {
        double value = modConfiguration.getCategory(category).getValues().get(key).getDouble(0.0);
        removeProperty(category, key);

        if (forceValue) {
          removeProperty(newCategory, newKey);
View Full Code Here

    public void init()
    {
        config = new Configuration(file);
        config.load();

        Property prop = config.get("WorldControl", "BlocksPerTick", 20);
        prop.comment = "Specifies the maximum blocks/tick that can be changed via the WorldControl functions. Powerful computers may set it higher, servers may want to keep it lower.";
        blocksPerTick = prop.getInt();
        OutputHandler.felog.info("Setting blocks/tick to: " + blocksPerTick);

        config.save();
    }
View Full Code Here

    }

    @Override
    public void forceSave()
    {
        Property prop = config.get("WorldControl", "BlocksPerTick", 20);
        prop.comment = "Specifies the maximum blocks/tick that can be changed via the WorldControl functions. Powerful computers may set it higher, servers may want to keep it lower.";
        prop.set(blocksPerTick);

        config.save();

    }
View Full Code Here

    public void init()
    {
        config.load();
        config.addCustomCategoryComment(Configuration.CATEGORY_GENERAL, "Configure ForgeEssentials .");

        Property prop = config.get(Configuration.CATEGORY_GENERAL, "allowCUI", true);
        prop.comment = "Set to false to disable graphical selections.";
        ForgeEssentialsClient.allowCUI = prop.getBoolean(true);
        // any other parts please config here
        config.save();
    }
View Full Code Here

    private boolean useFEBase = false;

    @Override
    public final void loadFromConfigs(Configuration config, String category) throws Exception
    {
        Property prop;

        String cat = category.substring(0, category.lastIndexOf('.'));

        prop = config.get(cat, "useFEDataDir", false);
        prop.comment = "Set to true to use the '.minecraft/ForgeEssentials/saves' directory instead of a world. Server owners may wish to set this to true.";

        useFEBase = prop.getBoolean(false);

        config.save();
    }
View Full Code Here

        this.config = config;

        config.addCustomCategoryComment("Data", "Configuration options for how ForgeEssentials will save its data for persistence between sessions.");

        // generates the configs...
        Property prop = config.get("Data", "storageType", defaultDriver.toString());
        prop.comment = "Specifies the variety of data storage FE will use. Options: " + StringUtils.join(EnumDriverType.values(), ", ");
        chosen = EnumDriverType.valueOf(prop.getString());

        typeChosens.put(EnumDriverType.TEXT, "ForgeConfig");
        typeChosens.put(EnumDriverType.BINARY, "NBT");
        typeChosens.put(EnumDriverType.SQL, "SQL_DB");

        String cat;
        for (EnumDriverType type : EnumDriverType.values())
        {
            if (type == EnumDriverType.SQL)
            {
                continue;
            }
            cat = "Data." + type;
            prop = config.get(cat, "chosenDriver", typeChosens.get(type));
            typeChosens.put(type, prop.getString());
        }
    }
View Full Code Here

TOP

Related Classes of net.minecraftforge.common.config.Property

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.