當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。