本文整理汇总了Java中net.minecraftforge.common.config.ConfigCategory.getValues方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigCategory.getValues方法的具体用法?Java ConfigCategory.getValues怎么用?Java ConfigCategory.getValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.config.ConfigCategory
的用法示例。
在下文中一共展示了ConfigCategory.getValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildChildScreen
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
@Override
protected GuiScreen buildChildScreen()
{
ConfigCategory cfg = ForgeModContainer.getConfig().getCategory(VERSION_CHECK_CAT);
Map<String, Property> values = new HashMap<String, Property>(cfg.getValues());
values.remove("Global");
Property global = ForgeModContainer.getConfig().get(VERSION_CHECK_CAT, "Global", true);
List<Property> props = new ArrayList<Property>();
for (ModContainer mod : ForgeVersion.gatherMods().keySet())
{
values.remove(mod.getModId());
props.add(ForgeModContainer.getConfig().get(VERSION_CHECK_CAT, mod.getModId(), true)); //Get or make the value in the config
}
props.addAll(values.values()); // Add any left overs from the config
Collections.sort(props, new Comparator<Property>()
{
@Override
public int compare(Property o1, Property o2)
{
return o1.getName().compareTo(o2.getName());
}
});
List<IConfigElement> list = new ArrayList<IConfigElement>();
list.add(new ConfigElement(global));
for (Property prop : props)
{
list.add(new ConfigElement(prop));
}
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed. The parent
// GuiConfig object's propertyList will also be refreshed to reflect the changes.
return new GuiConfig(this.owningScreen,
list,
this.owningScreen.modID, VERSION_CHECK_CAT, true, true,
GuiConfig.getAbridgedConfigPath(ForgeModContainer.getConfig().toString()));
}
示例2: sanityCheckRewardDifficulty
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private void sanityCheckRewardDifficulty(Configuration config, String difficulty) {
ConfigCategory category = config.getCategory(difficulty);
Map<String, Property> tiers = category.getValues();
for (Entry<String, Property> tier : tiers.entrySet()) {
try {
Integer.parseInt(tier.getKey());
sanityCheckRewardTier(difficulty, tier);
} catch (NumberFormatException e) {
StringBuilder sb = new StringBuilder();
sb.append("Configuration error for {0}: Invalid reward tier ''{2}'' in ''{1}''. ");
sb.append("The tier must be an integer value equal to or greater than zero");
throw new RuntimeException(MessageFormat.format(sb.toString(), Constants.MOD_ID, difficulty, tier.getKey()), e);
}
}
}