本文整理汇总了Java中net.minecraftforge.common.config.ConfigCategory.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigCategory.getChildren方法的具体用法?Java ConfigCategory.getChildren怎么用?Java ConfigCategory.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.config.ConfigCategory
的用法示例。
在下文中一共展示了ConfigCategory.getChildren方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChestGenerationHooks
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private static List<ChestGenHooks> getChestGenerationHooks() {
if (chestHooks != null)
return chestHooks;
chestHooks = new ArrayList<ChestGenHooks>();
final ConfigCategory c = chests.getCategory(ConfigProcessor.CONFIG_CHESTS);
for (final ConfigCategory p : c.getChildren()) {
if(!isContainerNode(p)) {
processEntry(null, p, chestHooks);
} else {
for (final ConfigCategory cc : p.getChildren())
processEntry(p, cc, chestHooks);
}
}
return chestHooks;
}
示例2: 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;
}
示例3: removeCategory
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
public void removeCategory(final ConfigCategory category)
{
for (final ConfigCategory child : category.getChildren())
{
removeCategory(child);
}
if (categories.containsKey(category.getQualifiedName()))
{
categories.remove(category.getQualifiedName());
if (category.parent != null)
{
category.parent.removeChild(category);
}
changed = true;
}
}
示例4: 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);
}
}
示例5: load
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
@Nonnull
public ConfigurationHelper load(@Nonnull final ConfigCategory category, @Nonnull final IConfigFilter filter) {
if (!filter.skipCategory(category)) {
for (final Entry<String, Property> e : category.getValues().entrySet())
if (!filter.skipProperty(category, e.getValue()))
this.load(category, e.getValue());
for (final ConfigCategory c : category.getChildren())
this.load(c, filter);
}
return this;
}
示例6: save
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
@Nonnull
public ConfigurationHelper save(@Nonnull final ConfigCategory category, @Nonnull final IConfigFilter filter) {
if (!filter.skipCategory(category)) {
if (category.requiresMcRestart() || category.requiresWorldRestart())
this.data.restartRequired();
for (final Entry<String, Property> e : category.getValues().entrySet())
if (!filter.skipProperty(category, e.getValue()))
this.save(category, e.getValue());
for (final ConfigCategory c : category.getChildren())
this.save(c, filter);
}
return this;
}
示例7: getSubCategory
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
public static ConfigCategory getSubCategory(ConfigCategory cat, String name) {
for (ConfigCategory subCat : cat.getChildren()) {
if (subCat.getName().equals(name))
return subCat;
}
return null;
}
示例8: loadConfigurationRegistry
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private static void loadConfigurationRegistry() {
TraceRegistry.INSTANCE.clear();
final ConfigCategory category = configuration.getCategory(Names.Config.Category.REGISTRY);
for (final ConfigCategory categoryRenderInfo : category.getChildren()) {
registerTraceRenderInformation(categoryRenderInfo.getName());
}
}
示例9: unregisterTraceRenderInformation
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
public static void unregisterTraceRenderInformation(final String name) {
final ConfigCategory category = configuration.getCategory(Names.Config.Category.REGISTRY);
for (final ConfigCategory categoryRenderInfo : category.getChildren()) {
if (name.equalsIgnoreCase(categoryRenderInfo.getName())) {
configuration.removeCategory(categoryRenderInfo);
}
}
}
示例10: getRegisteredEntityNames
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
public static List<String> getRegisteredEntityNames() {
final ArrayList<String> names = new ArrayList<String>();
final ConfigCategory category = configuration.getCategory(Names.Config.Category.REGISTRY);
for (final ConfigCategory categoryRenderInfo : category.getChildren()) {
names.add(categoryRenderInfo.getName());
}
return names;
}
示例11: BiomeConfiguration
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
public BiomeConfiguration(ConfigCategory mainConfigSection) {
for (ConfigCategory child : mainConfigSection.getChildren()) {
if (child.getName().equals("biometypes")) {
handleBiometypes(child);
}
if (child.getName().equals("treepopulation")) {
handleTreePopulation(child);
}
}
}
示例12: loadBiomeConfigs
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private static void loadBiomeConfigs(Configuration config) {
ConfigCategory biomeConfigurationsFromFile = config.getCategory("biomeconfiguration");
for (ConfigCategory biomeConfiguration : biomeConfigurationsFromFile.getChildren()) {
biomeConfigurations.add(new BiomeConfiguration(biomeConfiguration));
}
}
示例13: updateConfig
import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private void updateConfig()
{
final String items = "itemcommands";
configuration.setCategoryLanguageKey(items, "d3.cmd.config.items");
configuration.addCustomCategoryComment(items, "Make new categories like the example to add new commands that give a specific item.");
configuration.setCategoryRequiresWorldRestart(items, true);
{
final String example = items + ".key";
configuration.addCustomCategoryComment(example,
"Example, don't delete, just disable if you don't want it. Values in here are defaults, except for enabled.\n" +
"CHANGES: modid became modids! All mods have to be present for the command to work. Useful for compatibility items.");
configuration.getString("name", example, "key", "The name of the command. aka the part after the slash. Cannot have spaces. Case sensitive! Required!");
configuration.getStringList("aliases", example, new String[] {"spectre", "spectrekey"}, "A list of alternative names. Case sensitive!");
configuration.getBoolean("allowUsername", example, true, "Allow a username to be specified, to give the item to someone else.");
configuration.getStringList("modids", example, new String[] {"RandomThings"}, "The modid that needs to be loaded for this command to work. Case sensitive!");
configuration.getString("item", example, "RandomThings:spectreKey", "Like you would use in '/give' Required!");
configuration.getInt("meta", example, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, "Metadata or Damage value of the item.");
configuration.getInt("stacksize", example, 1, 0, 64, "The stacksize. 0 is a nice troll btw :p");
configuration.getString("message", example, "Here you go!", "The message that appears after a successful command.");
configuration.getString("displayname", example, "", "Set a custom display name if you want it.");
configuration.getBoolean("enabled", example, false, "Easy enable / disable here. Enabled by default!");
}
ConfigCategory root = configuration.getCategory(items);
for (ConfigCategory cat : root.getChildren())
{
if (!commandsMap.containsKey(cat.getQualifiedName()))
{
ItemCommandEntry entry = new ItemCommandEntry(cat);
commandsMap.put(entry.getUniqueName(), entry);
}
}
configuration.setCategoryLanguageKey(MODID, "d3.cmd.config.cmd");
configuration.addCustomCategoryComment(MODID, "Set any value to false to disable the command.");
configuration.setCategoryRequiresWorldRestart(MODID, true);
if (pastStart)
{
CommandHandler ch = (CommandHandler) FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager();
for (CommandEntry e : commandsMap.values())
{
boolean was = e.isEnabled();
e.doConfig(configuration);
boolean is = e.isEnabled();
if (pastStart && was != is) // If we are past start, and the status has changed
{
if (!is) // Remove
{
ch.getCommands().remove(e.getInstance().getCommandName());
for (String s : e.getInstance().getCommandAliases()) ch.getCommands().remove(s);
}
else // Add
{
ch.registerCommand(e.getInstance());
}
}
}
}
if (configuration.hasChanged()) configuration.save();
}