本文整理汇总了Java中net.minecraftforge.common.config.Property.setMaxValue方法的典型用法代码示例。如果您正苦于以下问题:Java Property.setMaxValue方法的具体用法?Java Property.setMaxValue怎么用?Java Property.setMaxValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.config.Property
的用法示例。
在下文中一共展示了Property.setMaxValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}