本文整理汇总了Java中net.minecraftforge.common.config.Property.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java Property.getDouble方法的具体用法?Java Property.getDouble怎么用?Java Property.getDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.config.Property
的用法示例。
在下文中一共展示了Property.getDouble方法的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: refresh
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
/**
* Refreshes this mod's configuration
*/
public void refresh()
{
load();
Property prop;
prop = get("options", "spinspeed", 1.0D);
prop.setLanguageKey("globalxp.config.spinspeed");
spinSpeed = prop.getDouble(1.0D);
prop = get("options", "bobspeed", 1.0D);
prop.setLanguageKey("globalxp.config.bobspeed");
bobSpeed = prop.getDouble(1.0D);
prop = get("options", "renderNameplate", true);
prop.setLanguageKey("globalxp.config.renderNameplate");
renderNameplate = prop.getBoolean(true);
if(hasChanged())
save();
}
示例3: getDoubleFor
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static double getDoubleFor(Configuration config,String heading, String item, double value, String comment)
{
if (config == null)
return value;
try
{
Property prop = config.get(heading, item, value);
prop.comment = comment;
return prop.getDouble(value);
}
catch (Exception e)
{
System.out.println("[" + ModDetails.ModName + "] Error while trying to add Double, config wasn't loaded properly!");
}
return value;
}
示例4: getAxeLevelMultiplier
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public double getAxeLevelMultiplier(int axeLevel)
{
if (axeLevelMap.containsKey(axeLevel))
return axeLevelMap.get(axeLevel);
double value = 1 + axeLevel;
if (axeMultipliers != null)
{
Property p = axeMultipliers.get("AxeLevel" + axeLevel);
if (p != null && p.wasRead())
{
value = p.getDouble();
}
}
axeLevelMap.put(axeLevel, value);
return value;
}
示例5: getDoubleFor
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static double getDoubleFor(Configuration config,String heading, String item, double value, String comment)
{
if (config == null)
return value;
try
{
Property prop = config.get(heading, item, value);
prop.comment = comment;
return prop.getDouble(value);
}
catch (Exception e)
{
System.out.println("[" + TFCPPDetails.ModName + "] Error while trying to add Double, config wasn't loaded properly!");
}
return value;
}
示例6: 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();
}
示例7: setDefault
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
private static void setDefault(@Nonnull final Configuration config, @Nonnull final String cat,
@Nonnull final String prop, final float prevDefault, final float newDefault) {
final ConfigCategory cc = config.getCategory(cat);
if (cc != null) {
final Property p = cc.get(prop);
if (p != null) {
final float cv = (float) p.getDouble();
if (cv == prevDefault)
p.set(newDefault);
}
}
}
示例8: getSafeDoubleFromProperty
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static double getSafeDoubleFromProperty(Property property, double min, double max) {
double temp = property.getDouble();
if (temp<min || temp>max) {
property.setToDefault();
temp = property.getDouble();
}
return temp;
}
示例9: getDoubleFor
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
public static double getDoubleFor(Configuration config, String heading, String item, double value) {
if (config == null)
return value;
try {
Property prop = config.get(heading, item, value);
return prop.getDouble(value);
} catch (Exception e) {
TFCTech.LOG.error("Error while trying to add Double, config wasn't loaded properly!");
}
return value;
}
示例10: 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);
}
示例11: loadConfig
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
static void loadConfig(File configurationFile)
{
config = new Configuration(configurationFile);
Property bl = config.get("items", "blacklist", new String[0]);
bl.setComment("List of items to disallow from placing in the belt.");
Property wl = config.get("items", "whitelist", new String[0]);
wl.setComment("List of items to force-allow placing in the belt. Takes precedence over blacklist.");
Property showBeltOnPlayersProperty = config.get("display", "showBeltOnPlayers", true);
showBeltOnPlayersProperty.setComment("If set to FALSE, the belts and tools will NOT draw on players.");
Property beltItemScaleProperty = config.get("display", "beltItemScale", 0.5);
beltItemScaleProperty.setComment("Changes the scale of items on the belt.");
Property releaseToSwapProperty = config.get("input", "releaseToSwap", false);
releaseToSwapProperty.setComment("If set to TRUE, releasing the menu key (R) will activate the swap. Requires a click otherwise (default).");
Property clipMouseToCircleProperty = config.get("input", "clipMouseToCircle", false);
clipMouseToCircleProperty.setComment("If set to TRUE, the radial menu will try to prevent the mouse from leaving the outer circle.");
Property allowClickOutsideBoundsProperty = config.get("input", "allowClickOutsideBounds", false);
allowClickOutsideBoundsProperty.setComment("If set to TRUE, the radial menu will allow clicking outside the outer circle to activate the items.");
display = config.getCategory("display");
display.setComment("Options for customizing the display of tools on the player");
input = config.getCategory("input");
input.setComment("Options for customizing the interaction with the radial menu");
showBeltOnPlayers = showBeltOnPlayersProperty.getBoolean();
beltItemScale = (float)beltItemScaleProperty.getDouble();
releaseToSwap = releaseToSwapProperty.getBoolean();
clipMouseToCircle = clipMouseToCircleProperty.getBoolean();
allowClickOutsideBounds = allowClickOutsideBoundsProperty.getBoolean();
blackListString.addAll(Arrays.asList(bl.getStringList()));
whiteListString.addAll(Arrays.asList(wl.getStringList()));
if (!bl.wasRead() ||
!wl.wasRead() ||
!releaseToSwapProperty.wasRead() ||
!showBeltOnPlayersProperty.wasRead() ||
!beltItemScaleProperty.wasRead() ||
!clipMouseToCircleProperty.wasRead() ||
!allowClickOutsideBoundsProperty.wasRead())
{
config.save();
}
}
示例12: DoubleConfigProperty
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
protected DoubleConfigProperty(final @Nonnull Configuration config, final @Nonnull Property property) {
super(config, property, property.getDouble());
}
示例13: dataFrom
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
@Override
public Double dataFrom(Property source) {
return source.getDouble(value());
}
示例14: dataFrom
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
@Override
public Double dataFrom(Property source) {
return source.getDouble(defaultValue);
}
示例15: DoubleConfigProperty
import net.minecraftforge.common.config.Property; //导入方法依赖的package包/类
protected DoubleConfigProperty(final Configuration config, final Property property) {
super(config, property, property.getDouble());
}