本文整理汇总了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;
}
示例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();
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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);
}
}