本文整理匯總了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);
}
}