本文整理汇总了Java中net.minecraftforge.common.config.ConfigCategory.getName方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigCategory.getName方法的具体用法?Java ConfigCategory.getName怎么用?Java ConfigCategory.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.config.ConfigCategory
的用法示例。
在下文中一共展示了ConfigCategory.getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
@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;
}
示例2: handleTreePopulation
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
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);
}
}
示例3: loadLocalGroups
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
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;
}
}
示例4: loadGlobalGroups
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
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;
}
}
示例5: createConfigurationCategory
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
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);
}
示例6: processEntry
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private static void processEntry(final ConfigCategory p, final ConfigCategory cc, final List<ChestGenHooks> list) {
String chestHookName = null;
if(p == null || cc.getName().startsWith("^"))
chestHookName = StringUtils.removeStart(cc.getName(), "^");
else
chestHookName = p.getName() + "." + cc.getName();
for (final Entry<String, Property> item : cc.getValues().entrySet()) {
final ItemStack stack = ItemStackHelper.getItemStack(item.getKey());
if (stack == null || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE) {
ModLog.warn("Invalid item: %s", item.getKey());
continue;
}
try {
final String values = item.getValue().getString();
final String[] parms = values.split(",");
if (parms.length == 3) {
final int min = Integer.valueOf(parms[0]);
final int max = Integer.valueOf(parms[1]);
final int weight = Integer.valueOf(parms[2]);
ChestGenHooks.addItem(chestHookName,
new WeightedRandomChestContent(stack, min, max, weight));
} else {
ModLog.warn("Invalid number of values in parameter string: %s", values);
}
} catch (final Exception e) {
ModLog.error("Unable to parse chest entry", e);
}
}
list.add(ChestGenHooks.getInfo(chestHookName));
ModLog.info("Loaded chest loot table '%s'", chestHookName);
}
示例7: 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);
}
}