當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。