当前位置: 首页>>代码示例>>Java>>正文


Java ConfigCategory.put方法代码示例

本文整理汇总了Java中net.minecraftforge.common.config.ConfigCategory.put方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigCategory.put方法的具体用法?Java ConfigCategory.put怎么用?Java ConfigCategory.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.common.config.ConfigCategory的用法示例。


在下文中一共展示了ConfigCategory.put方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:OreCruncher,项目名称:Restructured,代码行数:25,代码来源:ConfigProcessor.java

示例2: copyCategoryProps

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
/**
 * Copies property objects from another Configuration object to this one using the list of category names. Properties that only exist in the
 * "from" object are ignored. Pass null for the ctgys array to include all categories.
 */
public void copyCategoryProps(final Configuration fromConfig, String... ctgys)
{
    if (ctgys == null)
        ctgys = this.getCategoryNames().toArray(new String[this.getCategoryNames().size()]);
    
    for (final String ctgy : ctgys)
        if (fromConfig.hasCategory(ctgy) && this.hasCategory(ctgy))
        {
        	final ConfigCategory thiscc = this.getCategory(ctgy);
        	final ConfigCategory fromcc = fromConfig.getCategory(ctgy);
            for (final Entry<String, Property> entry : thiscc.getValues().entrySet())
                if (fromcc.containsKey(entry.getKey()))
                    thiscc.put(entry.getKey(), fromcc.get(entry.getKey()));
        }
}
 
开发者ID:OreCruncher,项目名称:Restructured,代码行数:20,代码来源:JarConfiguration.java

示例3: 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();
}
 
开发者ID:MyEssentials,项目名称:MyEssentials-Core,代码行数:21,代码来源:ConfigTemplate.java

示例4: serializeRecursive

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
public void serializeRecursive(ConfigCategory categoryCurrent, Object toSerialize)
{
	try
	{
		for (Field f : toSerialize.getClass().getDeclaredFields())
		{
			if (Modifier.isPublic(f.getModifiers()) && !Modifier.isStatic(f.getModifiers()) && !Modifier.isFinal(f.getModifiers()) && !f.isAnnotationPresent(ConfigIgnore.class))
			{
				if (f.getType().isPrimitive() || f.getType().equals(String.class))
				{
					categoryCurrent.put(f.getName(), new Property(f.getName(), f.get(toSerialize).toString(), fromJavaPrimitiveType(f.getType())));
				}
				else
				{
					boolean hasAdapter = false;
					for (ConfigAdapter<Object> a : adapters)
					{
						if (a.accepts(f.get(toSerialize)))
						{
							a.serialize(f.get(toSerialize), new ConfigCategory(f.getName(), categoryCurrent));
							hasAdapter = true;
							break;
						}
					}
					
					if (!hasAdapter)
					{
						serializeRecursive(new ConfigCategory(f.getName(), categoryCurrent), f.get(toSerialize));
					}
				}
			}
		}
	}
	catch (Exception ex)
	{
		VCLoggers.loggerErrors.log(LogLevel.Error, "Caught an exception trying to serialize a configuration file!", ex);
	}
}
 
开发者ID:V0idWa1k3r,项目名称:VoidApi,代码行数:39,代码来源:SerializableConfig.java

示例5: addConfigProperty

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
public static void addConfigProperty(Object mod, String propertyName, String value, Property.Type type)
{
    ModContainer container = getContainer(mod);
    if (container != null)
    {
        ConfigCategory cat = config.getCategory(container.getModId());
        Property prop = new Property(propertyName, value, type).setLanguageKey("forge.configgui." + propertyName);
        if (type == Property.Type.INTEGER)
        {
            prop.setMinValue(0);
        }
        cat.put(propertyName, prop);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:ForgeChunkManager.java

示例6: generateSoundList

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
protected void generateSoundList(final ConfigCategory cat) {
	cat.setRequiresMcRestart(false);
	cat.setRequiresWorldRestart(false);

	final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
	final List<String> sounds = new ArrayList<String>();
	for (final Object resource : handler.soundRegistry.getKeys())
		sounds.add(resource.toString());
	Collections.sort(sounds);

	final SoundRegistry registry = RegistryManager.get(RegistryType.SOUND);
	for (final String sound : sounds) {
		final Property prop = new Property(sound, "", Property.Type.STRING);
		prop.setDefaultValue("");
		prop.setRequiresMcRestart(false);
		prop.setRequiresWorldRestart(false);
		prop.setConfigEntryClass(SoundConfigEntry.class);
		final StringBuilder builder = new StringBuilder();
		if (registry.isSoundBlocked(sound))
			builder.append(GuiConstants.TOKEN_BLOCK).append(' ');
		if (registry.isSoundCulled(sound))
			builder.append(GuiConstants.TOKEN_CULL).append(' ');
		final float v = registry.getVolumeScale(sound);
		if (v != 1.0F)
			builder.append((int) (v * 100F));
		prop.setValue(builder.toString());
		cat.put(sound, prop);
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:30,代码来源:DynSurroundConfigGui.java

示例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();
}
 
开发者ID:GoryMoon,项目名称:MoarSigns,代码行数:11,代码来源:ConfigHandler.java

示例8: addBiomes

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private static void addBiomes(String[] included, String[] excluded, ConfigCategory parent) {
	ConfigCategory biomes = new ConfigCategory("biometypes", parent);
	
	biomes.put("1", new Property("Included", included, Property.Type.STRING));
	biomes.put("2", new Property("Excluded", excluded, Property.Type.STRING));
}
 
开发者ID:vidaj,项目名称:BigTrees,代码行数:7,代码来源:KTreeCfgBiomes.java

示例9: addOverriddenBiomes

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private static void addOverriddenBiomes(String[] biomeNames, ConfigCategory parent) {
	ConfigCategory biomes = new ConfigCategory("biometypes", parent);
	biomes.put("1", new Property("Specific", biomeNames, Property.Type.STRING));
}
 
开发者ID:vidaj,项目名称:BigTrees,代码行数:5,代码来源:KTreeCfgBiomes.java

示例10: addPropertiesToCategory

import net.minecraftforge.common.config.ConfigCategory; //导入方法依赖的package包/类
private static void addPropertiesToCategory(ConfigCategory category, Property ... properties) {
	int index = 1;
	for (Property property : properties) {
		category.put(Integer.toString(index++), property);
	}
}
 
开发者ID:vidaj,项目名称:BigTrees,代码行数:7,代码来源:KTreeCfgBiomes.java


注:本文中的net.minecraftforge.common.config.ConfigCategory.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。