本文整理汇总了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();
}
示例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;
}
示例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();
}
示例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();
}
}
示例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);
}
}
示例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();
}
}