本文整理汇总了Java中net.minecraftforge.common.config.Property.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getInt方法的具体用法?Java Property.getInt怎么用?Java Property.getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.config.Property
的用法示例。
在下文中一共展示了Property.getInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: constructFromConfig
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void constructFromConfig(String ID,
Potion effect,
String enableKey,
String enableComment,
int maxLevelDefault,
int defaultDifficultyCost,
double defaultWeight,
List<DifficultyModifier> returns,
Configuration config) {
Property modifierEnabledProp = config.get(ID,
enableKey, true, enableComment);
boolean modifierEnabled = modifierEnabledProp.getBoolean();
Property MaxLevelProp = config.get(ID,
"ModifierMaxLevel", maxLevelDefault, "Maximum level of this effect added to the target player when entering the cloud.");
int maxLevel = MaxLevelProp.getInt();
Property difficultyCostPerLevelProp = config.get(ID,
"DifficultyCostPerLevel", defaultDifficultyCost, "Cost of each level of the effect applied to the target player.");
int diffCostPerLevel = difficultyCostPerLevelProp.getInt();
Property selectionWeightProp = config.get(ID,
"ModifierWeight", defaultWeight, "Weight that affects how often this modifier is selected.");
double selectionWeight = selectionWeightProp.getDouble();
if (modifierEnabled && maxLevel > 0 && diffCostPerLevel > 0 && selectionWeight > 0) {
returns.add(new PotionCloudModifier(effect, maxLevel, diffCostPerLevel, selectionWeight, ID));
}
}
示例2: getIntFor
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static int getIntFor(Configuration config,String heading, String item, int value, String comment)
{
if (config == null)
return value;
try
{
Property prop = config.get(heading, item, value);
prop.comment = comment;
return prop.getInt(value);
}
catch (Exception e)
{
System.out.println("[" + ModDetails.ModName + "] Error while trying to add Integer, config wasn't loaded properly!");
}
return value;
}
示例3: gravesConfig
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void gravesConfig() {
// spawn rate
Property graveSpawnRateProperty = config.get(Config.CATEGORY_GRAVES, "GravesMobsSpawnRate", 1000);
graveSpawnRateProperty.setComment("This value must be bigger than 600!");
graveSpawnRate = graveSpawnRateProperty.getInt();
if (graveSpawnRate < 600) {
graveSpawnRate = 600;
}
spawnMobsByGraves = config.get(Config.CATEGORY_GRAVES, "SpawnMobsByGraves", true).getBoolean(true);
spawnMobAtGraveDestruction = config.get(Config.CATEGORY_GRAVES, "SpawnMobAtGraveDestruction", true).getBoolean(true);
spawnChance = config.get(Config.CATEGORY_GRAVES, "GravesMobsSpawnChance", 80).getInt();
isFogEnabled = config.get(Config.CATEGORY_GRAVES, "CemeteryFogEnabled", true).getBoolean(true);
}
示例4: 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;
}
示例5: getIntFor
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static int getIntFor(Configuration config,String heading, String item, int value, String comment)
{
if (config == null)
return value;
try
{
Property prop = config.get(heading, item, value);
prop.comment = comment;
return prop.getInt(value);
}
catch (Exception e)
{
System.out.println("[" + TFCPPDetails.ModName + "] Error while trying to add Integer, config wasn't loaded properly!");
}
return value;
}
示例6: getIntegerConfigNode
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static int getIntegerConfigNode(Configuration conf, Property prop, List<String> propOrder, String category, String key, String discription, int defaultInt) {
int out;
prop = conf.get(category, key, defaultInt);
prop.comment = discription;
prop.setLanguageKey("gc.configgui.dimensionIDMars").setRequiresMcRestart(true);
out = prop.getInt();
propOrder.add(prop.getName());
return out;
}
示例7: syncConfig
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void syncConfig() {
Property prop;
prop = config.get(Configuration.CATEGORY_GENERAL, "dimensionId", 37);
prop.setComment("ID for the dimension used by Genesis");
prop.setRequiresMcRestart(true);
prop.setLanguageKey("genesis.configgui.dimension_id");
dimensionId = prop.getInt();
if (config.hasChanged()) {
config.save();
}
}
示例8: handleConfig
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static void handleConfig(Configuration config){
Property current;
int chunkRange; double maxSpawnTime;
String[] dimensionArray = {"0"};
config.load();
current = config.get(Configuration.CATEGORY_GENERAL, "Logging", false);
current.setComment("Enable this to receive server messages whenever a villager tries to spawn. Default false.");
LOGGING = current.getBoolean();
current = config.get("SpawnValues", "Chunk check range", 2);
current.setComment("This is the range in chunks from each player that Emergent Villages checks for valid spawn positions. Default 2.");
chunkRange = current.getInt();
current = config.get("SpawnValues", "Inhabited time for maximum spawn chance", 3600000.0d);
current.setComment("This is the time in ticks at which the spawn chance for a villager for any given chunk is 100%. Minecraft increments this timer for each player "
+ "in a chunk once per tick. Increase this value for a slower spawn rate, and decrease it for a faster spawn rate. "
+ "Default 3600000.0f.");
maxSpawnTime = current.getDouble();
current = config.get(Configuration.CATEGORY_GENERAL, "Max villagers per chunk", 1);
current.setComment("This is the maximum amount of villagers that Emergent Villages spawns per chunk. Default 1.");
SpawnHandler.initConfig(chunkRange, current.getInt(), maxSpawnTime);
current = config.get(Configuration.CATEGORY_GENERAL , "Dimensions", dimensionArray);
current.setComment("These are the dimensions that Emergent Villages will spawn villagers in. Default 0 (Overworld).");
dimensionArray = current.getStringList();
current = config.get(Configuration.CATEGORY_GENERAL, "Tick speed", 600);
current.setComment("This is the amount of time that Emergent Villages waits between checks. Minecraft ticks 20 times per second. Higher numbers means that even if "
+ "the regional difficulty is high it will take a while to spawn villagers, but the impact on the server will be low. Lower numbers means villagers spawn "
+ "faster, up to the limit, but there will be a performance hit. Default 600.");
TickHandler.initConfig(current.getInt(), dimensionArray);
config.save();
}
示例9: 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();
}
示例10: 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();
}
}
示例11: syncConfig
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static void syncConfig() {
Property mbPerTankProp = config.get(Configuration.CATEGORY_GENERAL, "mbPerVirtualTank", 16000);
mbPerTankProp.setComment("How many millibuckets can each block within the tank store? (Has to be higher than 1!)\nDefault: 16000");
MB_PER_TANK_BLOCK = Math.max(1, Math.min(Integer.MAX_VALUE, mbPerTankProp.getInt(16000)));
if(mbPerTankProp.getInt(16000) < 1 || mbPerTankProp.getInt(16000) > Integer.MAX_VALUE) {
mbPerTankProp.set(16000);
}
Property maxAirBlocksProp = config.get(Configuration.CATEGORY_GENERAL, "maxAirBlocks", 2197);
maxAirBlocksProp.setComment("Define the maximum number of air blocks a tank can have. 2197 have been tested to not cause any feelable lag.!\nMinimum: 1, Maximum: 2197\nDefault: 2197");
MAX_AIR_BLOCKS = Math.max(1, Math.min(maxAirBlocksProp.getInt(2197), 2197));
if(maxAirBlocksProp.getInt(2197) < 3 || maxAirBlocksProp.getInt(1) > 2197) {
maxAirBlocksProp.set(2197);
}
Property tankOverlayRender = config.get(Configuration.CATEGORY_CLIENT, "tankOverlayRender", true);
tankOverlayRender.setComment("Should a semi-transparent tank overlay be rendered on the tank when you look at it?\nDefault: true");
TANK_OVERLAY_RENDER = tankOverlayRender.getBoolean(true);
Property metaphasedFluxEnergyLoss = config.get(Configuration.CATEGORY_GENERAL, "metaphasedFluxEnergyLoss", 10);
metaphasedFluxEnergyLoss.setComment("The amount of energy loss you have when you extract energy / metaphased flux from the tank.\nDefault: 10\nValue needs to be between 0 and 50!\n0 to disable.");
METAPHASED_FLUX_ENERGY_LOSS = Math.max(0, metaphasedFluxEnergyLoss.getInt(10));
if(metaphasedFluxEnergyLoss.getInt(10) < 0 || metaphasedFluxEnergyLoss.getInt(10) > 50) {
metaphasedFluxEnergyLoss.set(10);
}
if(config.hasChanged()) {
config.save();
}
}
示例12: getSafeIntFromProperty
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static int getSafeIntFromProperty(Property property, int min, int max) {
int temp = property.getInt();
if (temp<min || temp>max) {
property.setToDefault();
temp = property.getInt();
}
return temp;
}
示例13: getPaddingForChannel
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public int getPaddingForChannel(int channel) {
ConfigCategory cat = channel2category.get(channel);
if (cat == null) {
return defaultPadding;
}
Property prop = cat.get("padding");
return prop.getInt(defaultPadding);
}
示例14: syncMain
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void syncMain()
{
String category = "main";
List<String> propOrder = Lists.newArrayList();
Property prop;
prop = main.get(category, "difficulty", difficulty);
prop.setComment("Changes the difficulty of the mod: 0 = normal, 1 = hard, 2 = legendary.");
difficulty = prop.getInt();
propOrder.add(prop.getName());
main.setCategoryPropertyOrder(category, propOrder);
main.save();
}
示例15: registerTraceRenderInformation
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void registerTraceRenderInformation(final String categoryName, final String categoryQualifiedName) {
final Property propName = configuration.get(categoryQualifiedName, Names.Config.NAME, categoryName, Names.Config.NAME_DESC);
propName.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.NAME);
final String name = propName.getString();
final Property propColorRed = configuration.get(categoryQualifiedName, Names.Config.COLOR_RED, DEFAULT_COLOR_RED, Names.Config.COLOR_RED_DESC, 0, 255);
propColorRed.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.COLOR_RED);
final int red = propColorRed.getInt(DEFAULT_COLOR_RED);
final Property propColorGreen = configuration.get(categoryQualifiedName, Names.Config.COLOR_GREEN, DEFAULT_COLOR_GREEN, Names.Config.COLOR_GREEN_DESC, 0, 255);
propColorGreen.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.COLOR_GREEN);
final int green = propColorGreen.getInt(DEFAULT_COLOR_GREEN);
final Property propColorBlue = configuration.get(categoryQualifiedName, Names.Config.COLOR_BLUE, DEFAULT_COLOR_BLUE, Names.Config.COLOR_BLUE_DESC, 0, 255);
propColorBlue.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.COLOR_BLUE);
final int blue = propColorBlue.getInt(DEFAULT_COLOR_BLUE);
final Property propColorAlpha = configuration.get(categoryQualifiedName, Names.Config.COLOR_ALPHA, DEFAULT_COLOR_ALPHA, Names.Config.COLOR_ALPHA_DESC, 0, 255);
propColorAlpha.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.COLOR_ALPHA);
final int alpha = propColorAlpha.getInt(DEFAULT_COLOR_ALPHA);
final Property propTTL = configuration.get(categoryQualifiedName, Names.Config.TTL, DEFAULT_TTL, Names.Config.TTL_DESC, 1, 120);
propTTL.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.TTL);
final int ttl = propTTL.getInt(DEFAULT_TTL) * 20;
final Property propThickness = configuration.get(categoryQualifiedName, Names.Config.THICKNESS, DEFAULT_THICKNESS, Names.Config.THICKNESS_DESC, 1.0, 10.0);
propThickness.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.THICKNESS);
final double thickness = propThickness.getDouble(DEFAULT_THICKNESS);
final Property propOffsetY = configuration.get(categoryQualifiedName, Names.Config.OFFSET_Y, DEFAULT_OFFSET_Y, Names.Config.OFFSET_Y_DESC, -1.0, +1.0);
propOffsetY.setLanguageKey(Names.Config.LANG_PREFIX + "." + Names.Config.OFFSET_Y);
final double offsetY = propOffsetY.getDouble(DEFAULT_OFFSET_Y);
setCategoryPropertyOrder(categoryQualifiedName, Names.Config.NAME, Names.Config.COLOR_RED, Names.Config.COLOR_GREEN, Names.Config.COLOR_BLUE, Names.Config.COLOR_ALPHA, Names.Config.TTL, Names.Config.THICKNESS, Names.Config.OFFSET_Y);
Tracer.proxy.setConfigEntryClassSlider(propColorRed, propColorGreen, propColorBlue, propColorAlpha);
Tracer.proxy.setConfigEntryClassSlider(propTTL, propThickness, propOffsetY);
TraceRegistry.INSTANCE.register(name, red, green, blue, alpha, thickness, ttl, offsetY);
}