Java 类net.minecraftforge.common.config.ConfigCategory 实例源码

项目:McHeliPrivacyShield    文件:ConfigGuiFactory.java   
@SuppressWarnings({ "rawtypes" })
private static @Nonnull List<IConfigElement> getConfigElements() {
    final List<IConfigElement> list = new ArrayList<IConfigElement>();

    for (final String cat : Config.getConfig().getCategoryNames()) {
        final ConfigCategory cc = Config.getConfig().getCategory(cat);

        if (cc.isChild())
            continue;

        final ConfigElement ce = new ConfigElement<String>(cc);
        list.add(ce);
    }

    return list;
}
项目:Lector    文件:GeneralConfiguration.java   
public static void setupBookConfig(Configuration cfg) {
    ConfigCategory category = cfg.getCategory(CATEGORY_BOOKS);
    if (category.isEmpty()) {
        // Initialize with defaults
        addBook(cfg, Items.BOOK.getRegistryName().toString(), "*");
        addBook(cfg, Items.ENCHANTED_BOOK.getRegistryName().toString(), "*");
        addBook(cfg, Items.WRITABLE_BOOK.getRegistryName().toString(), "*");
        addBook(cfg, Items.WRITTEN_BOOK.getRegistryName().toString(), "*");
        addBook(cfg, "rftools:rftools_manual", BookType.BOOK_BLUE.getModel());
        addBook(cfg, "rftoolscontrol:rftoolscontrol_manual", BookType.BOOK_GREEN.getModel());
        addBook(cfg, "rftoolsdim:rftoolsdim_manual", BookType.BOOK_GREEN.getModel());
        addBook(cfg, "deepresonance:dr_manual", BookType.BOOK_RED.getModel());
    } else {
        for (Map.Entry<String, Property> entry : category.entrySet()) {
            validBooks.put(entry.getKey(), entry.getValue().getString());
        }
    }
}
项目:CustomWorldGen    文件:ForgeGuiFactory.java   
/**
 * This method is called in the constructor and is used to set the childScreen field.
 */
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig",
            AddModOverrideEntry.class));
    for (ConfigCategory cc : ForgeChunkManager.getModCategories())
        list.add(new ConfigElement(cc));

    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title,
            I18n.format("forge.configgui.ctgy.forgeChunkLoadingModConfig"));
}
项目:MacroKey    文件:JsonConfig.java   
public JsonConfig(File file){
    this.keybindingFile = new File(file.getParent()+"/macrokey/keybindings.json");
    this.layerFile = new File(file.getParent()+"/macrokey/layers.json");


    MacroKey.instance.boundKeys = new ArrayList<BoundKey>();
    MacroKey.instance.layers = new ArrayList<Layer>();


    File dir = new File(file.getParent()+"/macrokey/");
    if(!dir.exists()){
        dir.mkdir();
    }

    FileHelper.fileExist(keybindingFile);
    FileHelper.fileExist(layerFile);


    ConfigCategory category = MacroKey.instance.configuration.getCategory("bindings");
    if(!category.isEmpty()){
        LogHelper.info("Old Configuration File Detected! Converting...");
        convertConfig();
        MacroKey.instance.configuration.removeCategory(category);
        MacroKey.instance.configuration.save();
    }
}
项目:TRHS_Club_Mod_2016    文件:ForgeGuiFactory.java   
/**
 * This method is called in the constructor and is used to set the childScreen field.
 */
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig", 
            AddModOverrideEntry.class));
    for (ConfigCategory cc : ForgeChunkManager.getModCategories())
        list.add(new ConfigElement(cc));

    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title, 
            I18n.func_135052_a("forge.configgui.ctgy.forgeChunkLoadingModConfig"));
}
项目:SignPicture    文件:ConfigGui.java   
@SuppressWarnings("rawtypes")
private static @Nonnull List<IConfigElement> getConfigElements() {
    final List<IConfigElement> list = new ArrayList<IConfigElement>();

    for (final String cat : Config.getConfig().getCategoryNames()) {
        final ConfigCategory cc = Config.getConfig().getCategory(cat);

        if (cc.isChild())
            continue;

        final ConfigElement ce = new ConfigElement<String>(cc);
        list.add(ce);
    }

    return list;
}
项目:blockbuster    文件:GuiConfig.java   
private static List<IConfigElement> getConfigElements()
{
    List<IConfigElement> elements = new ArrayList<IConfigElement>();

    for (String name : Blockbuster.proxy.forge.getCategoryNames())
    {
        ConfigCategory category = Blockbuster.proxy.forge.getCategory(name);
        category.setLanguageKey("blockbuster.config." + name + ".title");

        if (name.indexOf(".") == -1)
        {
            elements.add(new ConfigElement(category));
        }
    }

    return elements;
}
项目:CodeChickenLib    文件:AbstractForgeConfigConditionalFactory.java   
@Override
public BooleanSupplier parse(JsonContext context, JsonObject json) {
    String category = JsonUtils.getString(json, "category");
    String key = JsonUtils.getString(json, "key");
    boolean flip = JsonUtils.getBoolean(json, "flip", false);

    if (config.hasCategory(category)) {
        ConfigCategory cat = config.getCategory(category);
        if (cat.containsKey(key) && cat.get(key).isBooleanValue()) {
            return () -> flip != cat.get(key).getBoolean();
        } else {
            throw new JsonParseException(String.format("Key doesn't exist on category or is not of a boolean type. Category: %s, Key: %s", category, key));
        }
    } else {
        throw new JsonParseException(String.format("Category doesn't exist on config file. Category: %s, Config: %s", category, config.getConfigFile().getAbsolutePath()));
    }
}
项目:EEWReciever    文件:ConfigGui.java   
@SuppressWarnings("rawtypes")
private static List<IConfigElement> getConfigElements() {
    final List<IConfigElement> list = new ArrayList<IConfigElement>();

    for (final String cat : ConfigHandler.instance.getCategoryNames()) {
        final ConfigCategory cc = ConfigHandler.instance.getCategory(cat);

        if (cc.isChild())
            continue;

        final ConfigElement ce = new ConfigElement<String>(cc);
        list.add(ce);
    }

    return list;
}
项目:Survivalist    文件:ConfigurationCondition.java   
@Override
public BooleanSupplier parse(JsonContext context, JsonObject json)
{
    JsonPrimitive categoryName = json.getAsJsonPrimitive("category");
    JsonPrimitive keyName = json.getAsJsonPrimitive("key");

    ConfigCategory category = ConfigManager.instance.config.getCategory(categoryName.getAsString());
    Property property = category != null ? category.get(keyName.getAsString()) : null;

    if (property == null)
    {
        Survivalist.logger.error("Property not found! {} / {}", categoryName.getAsString(), keyName.getAsString());
        return () -> false;
    }

    return property::getBoolean;
}
项目:Factorization    文件:HammerInfo.java   
boolean isFree(String name, int val) {
    for (String categoryName : channelConfig.getCategoryNames()) {
        ConfigCategory cat = channelConfig.getCategory(categoryName);
        if (cat.getQualifiedName().equals(name)) {
            if (channelConfig.get(categoryName, "channel", val).getInt() == val) {
                return true;
            }
            // Uhm.
            continue;
        }
        if (!cat.containsKey("channel")) {
            continue;
        }
        int here_chan = channelConfig.get(categoryName, "channel", -1).getInt();
        if (here_chan == val) {
            return false;
        }
    }
    return true;
}
项目:AquaMunda    文件:GeneralConfiguration.java   
public static void initGrindstoneRecipes(Configuration cfg) {
    ConfigCategory category = cfg.getCategory(CATEGORY_RECIPES_GRINDSTONE);
    if (category.isEmpty()) {
        // Initialize with defaults
        addRecipe(cfg, "flour", new ItemStack(Items.WHEAT), new ItemStack(ModItems.flour), 100);
        addRecipe(cfg, "bonemeal", new ItemStack(Items.BONE), new ItemStack(Items.DYE, 5, EnumDyeColor.WHITE.getDyeDamage()), 100);
        addRecipe(cfg, "flint", new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT, 2), 100);
        addRecipe(cfg, "glowstone", new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), 300);
        addRecipe(cfg, "sugar", new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 2), 100);
        addRecipe(cfg, "blazepowder", new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 3), 200);
    } else {
        for (Map.Entry<String, Property> entry : category.entrySet()) {
            String[] list = entry.getValue().getStringList();
            GrindstoneRecipeRepository.addRecipe(new GrindstoneRecipe(getItem(list, 0), getItem(list, 1), getInt(list, 2)));
        }
    }
}
项目:notenoughwands1.8.8    文件:MovingWand.java   
@Override
public void initConfig(Configuration cfg) {
    super.initConfig(cfg);
    maxHardness = (float) cfg.get(Config.CATEGORY_WANDS, getUnlocalizedName() + "_maxHardness", maxHardness, "Max hardness this block can move.)").getDouble();
    placeDistance = cfg.get(Config.CATEGORY_WANDS, getUnlocalizedName() + "_placeDistance", placeDistance, "Distance at which to place blocks in 'in-air' mode").getInt();

    ConfigCategory category = cfg.getCategory(Config.CATEGORY_MOVINGBLACKLIST);
    if (category.isEmpty()) {
        // Initialize with defaults
        blacklist(cfg, "tile.shieldBlock");
        blacklist(cfg, "tile.shieldBlock2");
        blacklist(cfg, "tile.shieldBlock3");
        blacklist(cfg, "tile.solidShieldBlock");
        blacklist(cfg, "tile.invisibleShieldBlock");
        setCost(cfg, "tile.mobSpawner", 5.0);
        setCost(cfg, "tile.blockAiry", 20.0);
    } else {
        for (Map.Entry<String, Property> entry : category.entrySet()) {
            blacklisted.put(entry.getKey(), entry.getValue().getDouble());
        }
    }
}
项目:Coding    文件:Configs.java   
public static void villageConfiguration() {
    ConfigCategory cat_village = config.getCategory(CATEGORY_VILLAGE);
    cat_village.setComment("Here you can configure the village generation");
    loadFields(cat_village, VILLAGE.class);

    if (VILLAGE.village_minDist < 0) {
        LogHelper.error("VillageDensity: Invalid config: Minimal distance must be non-negative.");
        VILLAGE.village_gen_enabled = false;
    }
    if (VILLAGE.village_minDist >= VILLAGE.village_density) {
        LogHelper.error("VillageDensity: Invalid config: Minimal distance must be smaller than density.");
        VILLAGE.village_gen_enabled = false;
    }
    if (VILLAGE.village_size < 0) {
        VILLAGE.village_gen_enabled = false;
        LogHelper.error("VillageDensity: Invalid config: Size must be non-negative.");
    }       
}
项目:Restructured    文件:Assets.java   
private static List<ChestGenHooks> getChestGenerationHooks() {

        if (chestHooks != null)
            return chestHooks;

        chestHooks = new ArrayList<ChestGenHooks>();
        final ConfigCategory c = chests.getCategory(ConfigProcessor.CONFIG_CHESTS);

        for (final ConfigCategory p : c.getChildren()) {
            if(!isContainerNode(p)) {
                processEntry(null, p, chestHooks);
            } else {
                for (final ConfigCategory cc : p.getChildren())
                    processEntry(p, cc, chestHooks);
            }
        }

        return chestHooks;
    }
项目:Restructured    文件:ConfigProcessor.java   
@Override
public boolean apply(final Object[] input) {
    final String prefix = (String) input[0];
    final InputStream stream = (InputStream) input[2];

    // The input stream contains the config file we need
    // to merge into the master.
    final JarConfiguration src = new JarConfiguration(stream);
    final ConfigCategory c = src.getCategory(CONFIG_CHESTS);

    // If the property in the chests.cfg has not been
    // initialized copy it from the ZIP.
    for (final ConfigCategory p : c.getChildren()) {
        final String name = CONFIG_CHESTS + "." + prefix + "." + p.getName();
        final ConfigCategory temp = target.getCategory(name);
        if (temp.isEmpty()) {
            for (final Entry<String, Property> item : p.getValues().entrySet()) {
                temp.put(item.getKey(), item.getValue());
            }
        }
    }

    return true;
}
项目:Restructured    文件:JarConfiguration.java   
public void removeCategory(final ConfigCategory category)
{
    for (final ConfigCategory child : category.getChildren())
    {
        removeCategory(child);
    }

    if (categories.containsKey(category.getQualifiedName()))
    {
        categories.remove(category.getQualifiedName());
        if (category.parent != null)
        {
            category.parent.removeChild(category);
        }
        changed = true;
    }
}
项目:Restructured    文件:JarConfiguration.java   
public boolean hasChanged()
{
    if (changed) return true;

    for (final ConfigCategory cat : categories.values())
    {
        if (cat.hasChanged()) return true;
    }

    for (final JarConfiguration child : children.values())
    {
        if (child.hasChanged()) return true;
    }

    return false;
}
项目:Restructured    文件:JarConfiguration.java   
/**
 * Copies property objects from another Configuration object to this one using the list of category names. Properties that only exist in the
 * "from" object are ignored. Pass null for the ctgys array to include all categories.
 */
public void copyCategoryProps(final Configuration fromConfig, String... ctgys)
{
    if (ctgys == null)
        ctgys = this.getCategoryNames().toArray(new String[this.getCategoryNames().size()]);

    for (final String ctgy : ctgys)
        if (fromConfig.hasCategory(ctgy) && this.hasCategory(ctgy))
        {
            final ConfigCategory thiscc = this.getCategory(ctgy);
            final ConfigCategory fromcc = fromConfig.getCategory(ctgy);
            for (final Entry<String, Property> entry : thiscc.getValues().entrySet())
                if (fromcc.containsKey(entry.getKey()))
                    thiscc.put(entry.getKey(), fromcc.get(entry.getKey()));
        }
}
项目:CauldronGit    文件:ForgeGuiFactory.java   
/**
 * This method is called in the constructor and is used to set the childScreen field.
 */
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig", 
            AddModOverrideEntry.class));
    for (ConfigCategory cc : ForgeChunkManager.getModCategories())
        list.add(new ConfigElement(cc));

    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title, 
            I18n.format("forge.configgui.ctgy.forgeChunkLoadingModConfig"));
}
项目:ThermalRecycling    文件:ScrappingTables.java   
private static void processTables(final String prefix, final Matrix2D<ItemStackWeightTable> weightTables, final JarConfiguration config) {
    for (final ScrapValue sv : ScrapValue.values())
        for (int i = 0; i < UPGRADE_NAMES.length; i++) {

            final String category = prefix + "_" + sv.name() + "_" + UPGRADE_NAMES[i];

            final ConfigCategory cc = config.getCategory(category);
            if(cc != null && !cc.isEmpty()) {

                final ItemStackWeightTable table = new ItemStackWeightTable();
                for(final Entry<String, Property> e: cc.getValues().entrySet()) {
                    final ItemStackItem item = getItemStackItem(table, e);
                    if(item != null)
                        table.add(item);
                }
                weightTables.set(sv.ordinal(), i, table);
            }
        }
}
项目:ThermalRecycling    文件:JarConfiguration.java   
public void removeCategory(final ConfigCategory category)
{
    for (final ConfigCategory child : category.getChildren())
    {
        removeCategory(child);
    }

    if (categories.containsKey(category.getQualifiedName()))
    {
        categories.remove(category.getQualifiedName());
        if (category.parent != null)
        {
            category.parent.removeChild(category);
        }
        changed = true;
    }
}
项目:ThermalRecycling    文件:JarConfiguration.java   
public boolean hasChanged()
{
    if (changed) return true;

    for (final ConfigCategory cat : categories.values())
    {
        if (cat.hasChanged()) return true;
    }

    for (final JarConfiguration child : children.values())
    {
        if (child.hasChanged()) return true;
    }

    return false;
}
项目:ThermalRecycling    文件:JarConfiguration.java   
/**
 * Copies property objects from another Configuration object to this one using the list of category names. Properties that only exist in the
 * "from" object are ignored. Pass null for the ctgys array to include all categories.
 */
public void copyCategoryProps(final Configuration fromConfig, String... ctgys)
{
    if (ctgys == null)
        ctgys = this.getCategoryNames().toArray(new String[this.getCategoryNames().size()]);

    for (final String ctgy : ctgys)
        if (fromConfig.hasCategory(ctgy) && this.hasCategory(ctgy))
        {
            final ConfigCategory thiscc = this.getCategory(ctgy);
            final ConfigCategory fromcc = fromConfig.getCategory(ctgy);
            for (final Entry<String, Property> entry : thiscc.getValues().entrySet())
                if (fromcc.containsKey(entry.getKey()))
                    thiscc.put(entry.getKey(), fromcc.get(entry.getKey()));
        }
}
项目:BigTrees    文件:BiomeConfiguration.java   
private void handleTreePopulation(ConfigCategory treePopulationCategory) {
    for (ConfigCategory treeConfig: treePopulationCategory.getChildren()) {
        String treeName = treeConfig.getName();

        int percentageChancePerChunk = 0;
        int treesPerChunk = 0;
        for (Entry<String, Property> entry : treeConfig.entrySet()) {
            if (entry.getKey().equals(Population.PercentageChancePerTreeConfigKey)) {
                percentageChancePerChunk = entry.getValue().getInt();
            }
            else if (entry.getKey().equals(Population.TreesPerChunkConfigKey)) {
                treesPerChunk = entry.getValue().getInt();
            }
        }

        Population population = new Population(percentageChancePerChunk, treesPerChunk);

        treePopulation.put(KTreeCfgTrees.getTreeConfiguration(treeName), population);
    }
}
项目:BigTrees    文件:BiomeConfiguration.java   
private void handleBiometypes(ConfigCategory child) {
    for(Entry<String, Property> entry : child.entrySet()) {
        Property property = entry.getValue();
        String propertyName = property.getName();

        if (propertyName.toLowerCase().equalsIgnoreCase("Included")) {
            includedBiomeTypes = toBiomeTypes(property.getStringList());
        } else if (propertyName.equalsIgnoreCase("Excluded")) {
            excludedBiomeTypes = toBiomeTypes(property.getStringList());
        } else if (propertyName.equalsIgnoreCase("Specific")) {
            for (String specificBiomeName : property.getStringList()) {
                specificBiomes.add(specificBiomeName.toLowerCase());
            }
        } else {
            FMLLog.getLogger().warn("Skipping biome configuration due to unknown property name '%s'", propertyName);
        }
    }
}
项目:BigTrees    文件:KTreeCfgBiomes.java   
private static void loadGeneralSettings(Configuration config) {
    ConfigCategory generalSettings = config.getCategory("general");

    for(Map.Entry<String, Property> entry : generalSettings.entrySet()) {
        String key = entry.getKey();
        Property property = entry.getValue();

        if (key.equals("Enable roots")) {
            KTreeCfg.rootsEnable = property.getBoolean();
        }
        else if (key.equals("Enabled dimension ids")) {
            KTreeCfg.enabledDimensionIds = toSet(property.getIntList());
        }
        else if (key.equals("Disabled dimension ids")) {
            KTreeCfg.disabledDimensionIds = toSet(property.getIntList());
        }
    }
}
项目:TickDynamic    文件:ListManager.java   
private void loadLocalGroups() {
    //Add local groups from config
    ConfigCategory config = mod.getWorldConfigCategory(world);
    Iterator<ConfigCategory> localIt;
    for(localIt = config.getChildren().iterator(); localIt.hasNext(); )
    {
        ConfigCategory localGroupCategory = localIt.next();
        String name = localGroupCategory.getName();
        EntityGroup localGroup = mod.getWorldEntityGroup(world, name, entityType, true, true);
        if(localGroup.getGroupType() != entityType || localGroups.contains(localGroup))
            continue;

        if(mod.debug)
            System.out.println("Load local group: " + name);
        localGroups.add(localGroup);
        localGroup.list = this;
    }
}
项目:TickDynamic    文件:ListManager.java   
private void loadGlobalGroups() {
    ConfigCategory config = mod.config.getCategory("groups");
    Iterator<ConfigCategory> globalIt;
    for(globalIt = config.getChildren().iterator(); globalIt.hasNext(); )
    {
        ConfigCategory groupCategory = globalIt.next();
        String name = groupCategory.getName();
        EntityGroup globalGroup = mod.getEntityGroup("groups." + name);

        if(globalGroup == null || globalGroup.getGroupType() != entityType)
            continue;

        //Get or create the local group as a copy of the global, but without a world config entry.
        //Will inherit config from the global group.
        EntityGroup localGroup = mod.getWorldEntityGroup(world, name, entityType, true, false);
        if(localGroups.contains(localGroup))
            continue; //Local group already defined

        if(mod.debug)
            System.out.println("Load global group: " + name);
        localGroups.add(localGroup);
        localGroup.list = this;
    }
}
项目:GlobalGameRules    文件:GGRConfig.java   
private void setValueToProp(ConfigCategory cat, HashMap<String, Value> list) {
    list.forEach((s, value) -> {
        if (cat.containsKey(s))
            cat.put(s,
                value.getType().equals(ValueType.BOOLEAN) ?
                        cat.get(s).setValue(value.getBooleanValue())
                                .setRequiresWorldRestart(value.getRequireWorldRestart())
                                .setShowInGui(value.getShowInGui()) :
                        value.getType().equals(ValueType.INTEGER) ?
                                cat.get(s).setValue(value.getIntegerValue())
                                        .setRequiresWorldRestart(value.getRequireWorldRestart())
                                        .setShowInGui(value.getShowInGui()) :
                                cat.get(s).setValue(value.getStringValue())
                                        .setRequiresWorldRestart(value.getRequireWorldRestart())
                                        .setShowInGui(value.getShowInGui())
            );
        else
            get(cat.getQualifiedName(), s, value.getStringValue(), "GameRule added by another mod or from commands")
                    .setRequiresWorldRestart(value.getRequireWorldRestart())
                    .setShowInGui(value.getShowInGui());
    });
}
项目:XRay-Mod    文件:ConfigHandler.java   
public static void setup(FMLPreInitializationEvent event ) {
    config = new Configuration( event.getSuggestedConfigurationFile() );
    config.load();
    XRay.currentDist = config.get(Configuration.CATEGORY_GENERAL, "searchdist", 0).getInt(); // Get our search distance.

    for( String category : config.getCategoryNames() ) // Iterate through each category in our config file.
    {
        ConfigCategory cat = config.getCategory( category );

        if( category.startsWith("ores.") )
        {
            String name = cat.get("name").getString();
            int id = cat.get("id").getInt();
            int meta = cat.get("meta").getInt();
            int[] color = {cat.get("red").getInt(), cat.get("green").getInt(), cat.get("blue").getInt()};
            boolean enabled = cat.get("enabled").getBoolean(false);

            XRay.searchList.add( new OreInfo( name, name.replaceAll("\\s+", ""), id, meta, color, enabled ) );
        }
    }

    config.save();
}
项目:notenoughwands    文件:MovingWand.java   
@Override
public void initConfig(Configuration cfg) {
    super.initConfig(cfg);
    maxHardness = (float) cfg.get(Config.CATEGORY_WANDS, getUnlocalizedName() + "_maxHardness", maxHardness, "Max hardness this block can move.)").getDouble();
    placeDistance = cfg.get(Config.CATEGORY_WANDS, getUnlocalizedName() + "_placeDistance", placeDistance, "Distance at which to place blocks in 'in-air' mode").getInt();

    ConfigCategory category = cfg.getCategory(Config.CATEGORY_MOVINGBLACKLIST);
    if (category.isEmpty()) {
        // Initialize with defaults
        blacklist(cfg, "tile.shieldBlock");
        blacklist(cfg, "tile.shieldBlock2");
        blacklist(cfg, "tile.shieldBlock3");
        blacklist(cfg, "tile.solidShieldBlock");
        blacklist(cfg, "tile.invisibleShieldBlock");
        setCost(cfg, "tile.mobSpawner", 5.0);
        setCost(cfg, "tile.blockAiry", 20.0);
    } else {
        for (Map.Entry<String, Property> entry : category.entrySet()) {
            blacklisted.put(entry.getKey(), entry.getValue().getDouble());
        }
    }
}
项目:minema    文件:MinemaConfigGui.java   
private static List<IConfigElement> getConfigElements(Configuration config) {
    // map config elements to their categories, except for CATEGORY_GENERAL
    List<IConfigElement> list = config.getCategoryNames().stream()
        .filter(catName -> !catName.equals(Configuration.CATEGORY_GENERAL))
        .map(catName -> new ConfigElement(config.getCategory(catName)))
        .collect(Collectors.toList());

    // add props in CATEGORY_GENERAL directly to the root of the list
    if (config.hasCategory(Configuration.CATEGORY_GENERAL)) {
        ConfigCategory catGeneral = config.getCategory(Configuration.CATEGORY_GENERAL);
        List<Property> props = catGeneral.getOrderedValues();            
        list.addAll(props.stream()
            .map(prop -> new ConfigElement(prop))
            .collect(Collectors.toList())
        );
    }

    return list;
}
项目:ClicketyClack    文件:KeyFilterConfig.java   
public static IConfigElement createConfigurationCategory(Configuration config) {
    final Property property = getProperty(config);

    final TIntSet values = new TIntHashSet(property.getIntList());

    final List<IConfigElement> filterList = Lists.newArrayList();

    for (int keyCode = 0; keyCode < Keyboard.KEYBOARD_SIZE; keyCode++) {
        final String keyName = Keyboard.getKeyName(keyCode);
        if (keyName != null)
            filterList.add(new FlagArrayElement(property, values, keyCode, keyName));
    }

    final ConfigCategory category = config.getCategory(ConfigValues.CATEGORY_KEY_FILTER);
    return new DummyCategoryElement(category.getName(), category.getLanguagekey(), filterList);
}
项目:Cauldron    文件:ForgeGuiFactory.java   
/**
 * This method is called in the constructor and is used to set the childScreen field.
 */
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig", 
            AddModOverrideEntry.class));
    for (ConfigCategory cc : ForgeChunkManager.getModCategories())
        list.add(new ConfigElement(cc));

    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title, 
            I18n.format("forge.configgui.ctgy.forgeChunkLoadingModConfig"));
}
项目:Cauldron    文件:ForgeGuiFactory.java   
/**
 * This method is called in the constructor and is used to set the childScreen field.
 */
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig", 
            AddModOverrideEntry.class));
    for (ConfigCategory cc : ForgeChunkManager.getModCategories())
        list.add(new ConfigElement(cc));

    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title, 
            I18n.format("forge.configgui.ctgy.forgeChunkLoadingModConfig"));
}
项目:Cauldron    文件:ForgeGuiFactory.java   
/**
 * This method is called in the constructor and is used to set the childScreen field.
 */
@Override
protected GuiScreen buildChildScreen()
{
    List<IConfigElement> list = new ArrayList<IConfigElement>();

    list.add(new DummyCategoryElement("addForgeChunkLoadingModCfg", "forge.configgui.ctgy.forgeChunkLoadingAddModConfig", 
            AddModOverrideEntry.class));
    for (ConfigCategory cc : ForgeChunkManager.getModCategories())
        list.add(new ConfigElement(cc));

    return new GuiConfig(this.owningScreen, list, this.owningScreen.modID,
            this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
            this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart, this.owningScreen.title, 
            I18n.format("forge.configgui.ctgy.forgeChunkLoadingModConfig"));
}
项目:MyEssentials-Core    文件:ConfigTemplate.java   
/**
 * Loads the config file from the hard drive
 */
public void reload() {
    config.load();
    for (ConfigProperty property : properties) {
        ConfigCategory category = config.getCategory(property.category);
        Property forgeProp;
        if (!category.containsKey(property.name)) {
            forgeProp = new Property(property.name, property.get().toString(), property.getType());
            forgeProp.comment = property.comment;
            category.put(property.name, forgeProp);
        } else {
            forgeProp = category.get(property.name);
            forgeProp.comment = property.comment;
        }
        setProperty(property, forgeProp);
    }
    config.save();
}
项目:TwinTails    文件:TwinTailsCommonProxy.java   
@Override
protected void registerConfig() {
    addConfigManager(new FileConfigManagerBuilder()
            .setFileName("twintails.cfg")
            .setDesc("TwinTails Configuration")
            .addCategory("general")
            .addValue("TwinTailsEffects", "false", Type.BOOLEAN,
                    "Enable to get effects while wearing certain twintails", new Consumer<Property>() {
                        @Override
                        public void accept(Property property) {
                            ItemHairBand.twinTailsEffects = property.getBoolean();
                        }
                    })
            .endCategory()
            .Update(new Consumer<Configuration>() {
                @Override
                public void accept(Configuration configuration) {
                    ConfigCategory gralCat = configuration.getCategory("general");
                    if (gralCat.containsKey("VersionCheck"))
                        gralCat.remove("VersionCheck");
                    if (gralCat.containsKey("VersionLatest"))
                        gralCat.remove("VersionLatest");
                }
            }));
}
项目:endernet    文件:EnderNet.java   
private void startServerManager() {
    Property globalPermissions = config.get("comm", "globalPermissions", "");
    Property undefinedPermissions = config.get("comm", "undefinedReceivePermissions", "");
    servers = new EnderServerManager(globalPermissions.getString(), undefinedPermissions.getString());
    reloadServerFile();

    ConfigCategory serverC = config.getCategory("servers");
       serverC.setComment("List servers in S:name=ip form, see endernet-servers.json for more detailed config");
       for(String name: serverC.keySet()) {
            if(servers.get(name) != null) continue;
               EnderServer es = new EnderServer(name, serverC.get(name).getString());
               servers.add(es);
       }

       saveServerFile();
}