當前位置: 首頁>>代碼示例>>Java>>正文


Java Property.setMinValue方法代碼示例

本文整理匯總了Java中net.minecraftforge.common.config.Property.setMinValue方法的典型用法代碼示例。如果您正苦於以下問題:Java Property.setMinValue方法的具體用法?Java Property.setMinValue怎麽用?Java Property.setMinValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.common.config.Property的用法示例。


在下文中一共展示了Property.setMinValue方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadFile

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
public static void loadFile(File file) {
    FMLLog.info("[Muon] %s", "Loading config from "+file.getName());
    // Sets up a new config
    config = new Configuration(file);
    config.load();

    config.setCategoryComment(CATEGORY_GENERATION, "Options controlling generation of new villages.\nThese only take effect as new chunks are generated.");
    properties.put("enable_new_by_default", config.get(CATEGORY_GENERATION, "enable_new_by_default", false, "Enable features of new versions by default"));
    properties.put("fix_buried_doors", config.get(CATEGORY_GENERATION, "fix_buried_doors", true, "Align village buildings with the path only"));
    properties.put("better_paths", config.get(CATEGORY_GENERATION, "better_paths", true, "Use alternate function for creating village paths"));
    properties.put("smooth_village_terrain", config.get(CATEGORY_GENERATION, "smooth_village_terrain", true, "Smooth terrain within village boundaries"));
    properties.put("fix_scattered_features", config.get(CATEGORY_GENERATION, "fix_scattered_features", true, "Ensure scattered features (e.g. Desert temples and Igloos) are accessible."));
    int village_grove_frequency_default = 0;
    if (getBoolean("enable_new_by_default")) {
        if (!config.hasKey(CATEGORY_GENERATION, "village_grove_frequency")) {
            village_grove_frequency_default = 100;
        }
    }
    Property village_grove_frequency = config.get(CATEGORY_GENERATION, "village_grove_frequency", village_grove_frequency_default, "Add stands of trees to villages.");
    village_grove_frequency.setMinValue(0);
    village_grove_frequency.setMaxValue(100);
    properties.put("village_grove_frequency", village_grove_frequency);

    // write out default config if necessary
    config.save();
}
 
開發者ID:MinimumContent,項目名稱:muon,代碼行數:27,代碼來源:MuonConfig.java

示例2: getIntFor

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
public static int getIntFor(Configuration config, String heading, String item, int value, int minValue, int maxValue, String comment) {
	if (config == null)
		return value;
	try {
		Property prop = config.get(heading, item, value);
		prop.comment = comment + " [range: " + minValue + " ~ " + maxValue + ", default: " + value + "]";
		prop.setMinValue(minValue);
		prop.setMaxValue(maxValue);
		if (prop.getInt(value) < minValue || prop.getInt(value) > maxValue) {
			TFCTech.LOG.info("An invalid value has been entered for " + item
					+ " in the config file. Reverting to the default value.");
			prop.set(value);
			return value;
		}
		return prop.getInt(value);
	} catch (Exception e) {
		TFCTech.LOG.error("Error while trying to add Integer, config wasn't loaded properly!");
	}
	return value;
}
 
開發者ID:Shurgent,項目名稱:TFCTech,代碼行數:21,代碼來源:ModOptions.java

示例3: syncConfig

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
private static void syncConfig(boolean loadFromConfigFile, boolean readFieldsFromConfig) {
	if (loadFromConfigFile)
		config.load();

	Property propertyMachineCooldownBasic = config.get(CATEGORY_NAME_BLOCKS, "machine_cooldown_basic", 100);
	propertyMachineCooldownBasic.setLanguageKey("gui.config.blocks.machine_cooldown_basic.name");
	propertyMachineCooldownBasic.setComment(I18n.format("gui.config.blocks.machine_cooldown_basic.comment"));
	propertyMachineCooldownBasic.setMinValue(10);
	propertyMachineCooldownBasic.setMaxValue(200);
	Property propertyMachineCooldownAdvanced = config.get(CATEGORY_NAME_BLOCKS, "machine_cooldown_advanced", 50);
	propertyMachineCooldownAdvanced.setLanguageKey("gui.config.blocks.machine_cooldown_advanced.name");
	propertyMachineCooldownAdvanced.setComment(I18n.format("gui.config.blocks.machine_cooldown_advanced.comment"));
	propertyMachineCooldownAdvanced.setMinValue(10);
	propertyMachineCooldownAdvanced.setMaxValue(200);

	List<String> propertyOrderBlocks = new ArrayList<String>();
	propertyOrderBlocks.add(propertyMachineCooldownBasic.getName());
	propertyOrderBlocks.add(propertyMachineCooldownAdvanced.getName());
	config.setCategoryPropertyOrder(CATEGORY_NAME_BLOCKS, propertyOrderBlocks);

	if (readFieldsFromConfig) {
		machineCooldownBasic = propertyMachineCooldownBasic.getInt();
		machineCooldownAdvanced = propertyMachineCooldownAdvanced.getInt();
	}

	propertyMachineCooldownBasic.set(machineCooldownBasic);
	propertyMachineCooldownAdvanced.set(machineCooldownAdvanced);

	if (config.hasChanged())
		config.save();
}
 
開發者ID:IvanSteklow,項目名稱:VanillaExtras,代碼行數:32,代碼來源:VExConfig.java

示例4: syncConfigDefaults

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
/**
 * Synchronizes the local fields with the values in the Configuration object.
 */
public static void syncConfigDefaults()
{
    // By adding a property order list we are defining the order that the properties will appear both in the config file and on the GUIs.
    // Property order lists are defined per-ConfigCategory.
    List<String> propOrder = new ArrayList<String>();

    config.setCategoryComment("defaults", "Default configuration for forge chunk loading control")
            .setCategoryRequiresWorldRestart("defaults", true);

    Property temp = config.get("defaults", "enabled", true);
    temp.setComment("Are mod overrides enabled?");
    temp.setLanguageKey("forge.configgui.enableModOverrides");
    overridesEnabled = temp.getBoolean(true);
    propOrder.add("enabled");

    temp = config.get("defaults", "maximumChunksPerTicket", 25);
    temp.setComment("The default maximum number of chunks a mod can force, per ticket, \n" +
                "for a mod without an override. This is the maximum number of chunks a single ticket can force.");
    temp.setLanguageKey("forge.configgui.maximumChunksPerTicket");
    temp.setMinValue(0);
    defaultMaxChunks = temp.getInt(25);
    propOrder.add("maximumChunksPerTicket");

    temp = config.get("defaults", "maximumTicketCount", 200);
    temp.setComment("The default maximum ticket count for a mod which does not have an override\n" +
                "in this file. This is the number of chunk loading requests a mod is allowed to make.");
    temp.setLanguageKey("forge.configgui.maximumTicketCount");
    temp.setMinValue(0);
    defaultMaxCount = temp.getInt(200);
    propOrder.add("maximumTicketCount");

    temp = config.get("defaults", "playerTicketCount", 500);
    temp.setComment("The number of tickets a player can be assigned instead of a mod. This is shared across all mods and it is up to the mods to use it.");
    temp.setLanguageKey("forge.configgui.playerTicketCount");
    temp.setMinValue(0);
    playerTicketLength = temp.getInt(500);
    propOrder.add("playerTicketCount");

    temp = config.get("defaults", "dormantChunkCacheSize", 0);
    temp.setComment("Unloaded chunks can first be kept in a dormant cache for quicker\n" +
                "loading times. Specify the size (in chunks) of that cache here");
    temp.setLanguageKey("forge.configgui.dormantChunkCacheSize");
    temp.setMinValue(0);
    dormantChunkCacheSize = temp.getInt(0);
    propOrder.add("dormantChunkCacheSize");
    FMLLog.info("Configured a dormant chunk cache size of %d", temp.getInt(0));

    config.setCategoryPropertyOrder("defaults", propOrder);

    config.addCustomCategoryComment("Forge", "Sample mod specific control section.\n" +
            "Copy this section and rename the with the modid for the mod you wish to override.\n" +
            "A value of zero in either entry effectively disables any chunkloading capabilities\n" +
            "for that mod");

    temp = config.get("Forge", "maximumTicketCount", 200);
    temp.setComment("Maximum ticket count for the mod. Zero disables chunkloading capabilities.");
    temp = config.get("Forge", "maximumChunksPerTicket", 25);
    temp.setComment("Maximum chunks per ticket for the mod.");
    for (String mod : config.getCategoryNames())
    {
        if (mod.equals("Forge") || mod.equals("defaults"))
        {
            continue;
        }
        config.get(mod, "maximumTicketCount", 200).setLanguageKey("forge.configgui.maximumTicketCount").setMinValue(0);
        config.get(mod, "maximumChunksPerTicket", 25).setLanguageKey("forge.configgui.maximumChunksPerTicket").setMinValue(0);
    }

    if (config.hasChanged())
    {
        config.save();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:77,代碼來源:ForgeChunkManager.java

示例5: addConfigProperty

import net.minecraftforge.common.config.Property; //導入方法依賴的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: syncConfigDefaults

import net.minecraftforge.common.config.Property; //導入方法依賴的package包/類
/**
 * Synchronizes the local fields with the values in the Configuration object.
 */
public static void syncConfigDefaults()
{
    // By adding a property order list we are defining the order that the properties will appear both in the config file and on the GUIs.
    // Property order lists are defined per-ConfigCategory.
    List<String> propOrder = new ArrayList<String>();

    config.setCategoryComment("defaults", "Default configuration for forge chunk loading control")
            .setCategoryRequiresWorldRestart("defaults", true);

    Property temp = config.get("defaults", "enabled", true);
    temp.comment = "Are mod overrides enabled?";
    temp.setLanguageKey("forge.configgui.enableModOverrides");
    overridesEnabled = temp.getBoolean(true);
    propOrder.add("enabled");

    temp = config.get("defaults", "maximumChunksPerTicket", 25);
    temp.comment = "The default maximum number of chunks a mod can force, per ticket, \n" +
                "for a mod without an override. This is the maximum number of chunks a single ticket can force.";
    temp.setLanguageKey("forge.configgui.maximumChunksPerTicket");
    temp.setMinValue(0);
    defaultMaxChunks = temp.getInt(25);
    propOrder.add("maximumChunksPerTicket");

    temp = config.get("defaults", "maximumTicketCount", 200);
    temp.comment = "The default maximum ticket count for a mod which does not have an override\n" +
                "in this file. This is the number of chunk loading requests a mod is allowed to make.";
    temp.setLanguageKey("forge.configgui.maximumTicketCount");
    temp.setMinValue(0);
    defaultMaxCount = temp.getInt(200);
    propOrder.add("maximumTicketCount");

    temp = config.get("defaults", "playerTicketCount", 500);
    temp.comment = "The number of tickets a player can be assigned instead of a mod. This is shared across all mods and it is up to the mods to use it.";
    temp.setLanguageKey("forge.configgui.playerTicketCount");
    temp.setMinValue(0);
    playerTicketLength = temp.getInt(500);
    propOrder.add("playerTicketCount");

    temp = config.get("defaults", "dormantChunkCacheSize", 0);
    temp.comment = "Unloaded chunks can first be kept in a dormant cache for quicker\n" +
                "loading times. Specify the size (in chunks) of that cache here";
    temp.setLanguageKey("forge.configgui.dormantChunkCacheSize");
    temp.setMinValue(0);
    dormantChunkCacheSize = temp.getInt(0);
    propOrder.add("dormantChunkCacheSize");
    FMLLog.info("Configured a dormant chunk cache size of %d", temp.getInt(0));

    config.setCategoryPropertyOrder("defaults", propOrder);

    config.addCustomCategoryComment("Forge", "Sample mod specific control section.\n" +
            "Copy this section and rename the with the modid for the mod you wish to override.\n" +
            "A value of zero in either entry effectively disables any chunkloading capabilities\n" +
            "for that mod");

    temp = config.get("Forge", "maximumTicketCount", 200);
    temp.comment = "Maximum ticket count for the mod. Zero disables chunkloading capabilities.";
    temp = config.get("Forge", "maximumChunksPerTicket", 25);
    temp.comment = "Maximum chunks per ticket for the mod.";
    for (String mod : config.getCategoryNames())
    {
        if (mod.equals("Forge") || mod.equals("defaults"))
        {
            continue;
        }
        config.get(mod, "maximumTicketCount", 200).setLanguageKey("forge.configgui.maximumTicketCount").setMinValue(0);
        config.get(mod, "maximumChunksPerTicket", 25).setLanguageKey("forge.configgui.maximumChunksPerTicket").setMinValue(0);
    }

    if (config.hasChanged())
    {
        config.save();
    }
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:77,代碼來源:ForgeChunkManager.java


注:本文中的net.minecraftforge.common.config.Property.setMinValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。