当前位置: 首页>>代码示例>>Java>>正文


Java ConfigCategory.get方法代码示例

本文整理汇总了Java中net.minecraftforge.common.config.ConfigCategory.get方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigCategory.get方法的具体用法?Java ConfigCategory.get怎么用?Java ConfigCategory.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.config.ConfigCategory的用法示例。


在下文中一共展示了ConfigCategory.get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
@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;
}
 
开发者ID:gigaherz,项目名称:Survivalist,代码行数:18,代码来源:ConfigurationCondition.java

示例2: reload

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:MyEssentials,项目名称:MyEssentials-Core,代码行数:21,代码来源:ConfigTemplate.java

示例3: setDefault

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private static void setDefault(@Nonnull final Configuration config, @Nonnull final String cat,
		@Nonnull final String prop, final float prevDefault, final float newDefault) {
	final ConfigCategory cc = config.getCategory(cat);
	if (cc != null) {
		final Property p = cc.get(prop);
		if (p != null) {
			final float cv = (float) p.getDouble();
			if (cv == prevDefault)
				p.set(newDefault);
		}
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:13,代码来源:ModOptions.java

示例4: parse

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
@Override
public Ingredient 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.get(keyName.getAsString());

    if (property.getBoolean())
        return CraftingHelper.getIngredient(json.getAsJsonObject("then"), context);

    return CraftingHelper.getIngredient(json.getAsJsonObject("else"), context);
}
 
开发者ID:gigaherz,项目名称:Survivalist,代码行数:15,代码来源:ConfigurationToggledIngredient.java

示例5: getPaddingForChannel

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
public int getPaddingForChannel(int channel) {
    ConfigCategory cat = channel2category.get(channel);
    if (cat == null) {
        return defaultPadding;
    }
    Property prop = cat.get("padding");
    return prop.getInt(defaultPadding);
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:9,代码来源:HammerInfo.java

示例6: parse

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
@Override
public BooleanSupplier parse(JsonContext context, JsonObject json)
{
    JsonPrimitive categoryName = json.getAsJsonPrimitive("category");
    JsonPrimitive keyName = json.getAsJsonPrimitive("key");

    ConfigCategory category = ConfigValues.config.getCategory(categoryName.getAsString());
    Property property = category.get(keyName.getAsString());

    return property::getBoolean;
}
 
开发者ID:gigaherz,项目名称:Ender-Rift,代码行数:12,代码来源:ConfigurationCondition.java

示例7: saveConfig

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
public void saveConfig() {
    ConfigCategory cat = config.getCategory(CATEGORY_GENERAL);

    Property prop = cat.get(REPLACE_KEY);
    prop.setValue(ModItems.replaceRecipes);
    cat.put(REPLACE_KEY, prop);

    if (config.hasChanged())
        config.save();
}
 
开发者ID:GoryMoon,项目名称:MoarSigns,代码行数:11,代码来源:ConfigHandler.java

示例8: loadRules

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private static void loadRules() {
	for (ConfigCategory rule : configuration.getCategory(R.CATEGORY_RULES).getChildren()) {
		// Do nothing if is example rule
		if (rule.getName().equalsIgnoreCase("example"))
			break;

		// Create new rule
		if (debug)
			LogHelper.info("Creating rule: " + rule.getName());
		TweakRule currentRule = new TweakRule(rule.getName());

		// Set affected biomes
		if (rule.get(R.CONFIG_AFFECTED_BIOMES) != null)
			currentRule.setAffectedBiomes(rule.get(R.CONFIG_AFFECTED_BIOMES).getStringList());

		// Set biome types
		if (rule.get(R.CONFIG_BIOME_TYPE) != null)
			currentRule.setBiomeTypes(rule.get(R.CONFIG_BIOME_TYPE).getStringList());

		// Set biome name
		if (rule.get(R.CONFIG_BIOME_NAME) != null)
			currentRule.setName(rule.get(R.CONFIG_BIOME_NAME).getString());

		// Rainfall
		if (rule.get(R.CONFIG_RAINFALL) != null)
			currentRule.setRainfall(rule.get(R.CONFIG_RAINFALL).getString());

		// Temperature
		if (rule.get(R.CONFIG_TEMPERATURE) != null)
			currentRule.setTemperature(rule.get(R.CONFIG_TEMPERATURE).getString());

		// Important Disable Rain or enable Snow after set Rainfall and
		// Temperature
		// Disable Rain
		if (rule.get(R.CONFIG_DISABLE_RAIN) != null
				&& rule.get(R.CONFIG_DISABLE_RAIN).getBoolean()) {
			currentRule.disableRain();
		}

		// Enable Snow
		if (rule.get(R.CONFIG_ENABLE_SNOW) != null
				&& rule.get(R.CONFIG_ENABLE_SNOW).getBoolean()) {
			currentRule.enableSnow();
		}

		// Log rules and errors
		if (ConfigurationHandler.debug) {
			currentRule.debug();
			currentRule.logErros(rule);
		}

		// Add rules in configuration handler
		ConfigurationHandler.tweakRules.add(currentRule);
	}
}
 
开发者ID:Zehir,项目名称:BiomesTweaker,代码行数:56,代码来源:ConfigurationHandler.java


注:本文中的net.minecraftforge.common.config.ConfigCategory.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。