net.minecraft.util.WeightedRandomChestContent#net.minecraftforge.common.config.Property源码实例Demo

下面列出了net.minecraft.util.WeightedRandomChestContent#net.minecraftforge.common.config.Property 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: mobycraft   文件: ConfigurationCommands.java
@Override
public ConfigProperties getConfigProperties() {
	Property property = Mobycraft.config.get("files", "docker-host", "Docker host IP",
			"The IP of your Docker host (set using /docker host <host>); only used if DOCKER_HOST environment variable is not set");
	if (property.isDefault()) {
		property.setValue(getDefaultHost());
	}
	configProperties.setDockerHostProperty(property);

	property = Mobycraft.config.get("files", "docker-cert-path", "File path",
			"The directory path of your Docker certificate (set using /docker path <path>); only used if DOCKER_CERT_PATH environment variable is not set");
	if (property.isDefault()) {
		property.setValue(getDefaultPath());
	}
	configProperties.setCertPathProperty(property);

	configProperties.setStartPosProperty(Mobycraft.config.get("container-building", "start-pos", "0, 0, 0",
			"The position - x, y, z - to start building containers at (set using /docker start_pos"));

	configProperties.setPollRateProperty(Mobycraft.config.get("container-building", "poll-rate", "2",
			"The rate in seconds at which the containers will update (set using /docker poll_rate <rate in seconds>)"));

	MainCommand.maxCount = (int) Math.floor((Float.parseFloat(configProperties.getPollRateProperty().getString()) * 50));

	return configProperties;
}
 
源代码2 项目: Production-Line   文件: PLConfig.java
public static void init(File configFile) {
    instance = new PLConfig(configFile);

    if (!configFile.exists()) {
        gtiLogger.log(Level.ERROR, "Cannot create ProductionLine config file");
        gtiLogger.log(Level.INFO, "Skipping config load");
    } else {
        instance.load();

        Property throwableUran238 = instance.get(CATEGORY_GENERAL, "ThrowableUran238", true);
        throwableUran238.setComment("Allow throw uranium 238, was hit after the radiation effect");
        instance.throwableUran238 = throwableUran238.getBoolean();

        Property throwablePackagedSalt = instance.get(CATEGORY_GENERAL, "ThrowablePackagedSalt", true);
        throwablePackagedSalt.setComment("Allow throw uranium 238, was hit after the salty effect");
        instance.throwablePackagedSalt = throwablePackagedSalt.getBoolean();

        instance.explosiveFurnace = instance.get(CATEGORY_GENERAL, "ExplosiveFurnace", true).getBoolean();

        instance.save();
    }
    gtiLogger.log(Level.INFO, "ProductionLine config loaded");
}
 
源代码3 项目: TFC2   文件: TFCOptions.java
public static boolean getBooleanFor(Configuration config,String heading, String item, boolean value, String comment)
{
	if (config == null)
		return value;
	try
	{
		Property prop = config.get(heading, item, value);
		prop.setComment(comment);
		return prop.getBoolean(value);
	}
	catch (Exception e)
	{
		System.out.println("[TFC2] Error while trying to add Integer, config wasn't loaded properly!");
	}
	return value;
}
 
源代码4 项目: TFC2   文件: TFCOptions.java
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.setComment(comment);
		return prop.getInt(value);
	}
	catch (Exception e)
	{
		System.out.println("[TFC2] Error while trying to add Integer, config wasn't loaded properly!");
	}
	return value;
}
 
源代码5 项目: TFC2   文件: TFCOptions.java
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.setComment(comment);
		return prop.getDouble(value);
	}
	catch (Exception e)
	{
		System.out.println("[TFC2] Error while trying to add Double, config wasn't loaded properly!");
	}
	return value;
}
 
源代码6 项目: GardenCollection   文件: ConfigManager.java
public ConfigManager (File file) {
    config = new Configuration(file);

    Property propEnableCompostBonemeal = config.get(Configuration.CATEGORY_GENERAL, "enableCompostBonemeal", true);
    propEnableCompostBonemeal.comment = "Allows compost trigger plant growth like bonemeal.";
    enableCompostBonemeal = propEnableCompostBonemeal.getBoolean();

    Property propCompostBonemealStrength = config.get(Configuration.CATEGORY_GENERAL, "compostBonemealStrength", 0.5);
    propCompostBonemealStrength.comment = "The probability that compost will succeed when used as bonemeal relative to bonemeal.";
    compostBonemealStrength = propCompostBonemealStrength.getDouble();

    Property propEnableTilledSoilGrowthBonus = config.get(Configuration.CATEGORY_GENERAL, "enableTilledSoilGrowthBonus", true).setRequiresMcRestart(true);
    propEnableTilledSoilGrowthBonus.comment = "Allows tilled garden soil to advance crop growth more quickly.  Enables random ticks.";
    enableTilledSoilGrowthBonus = propEnableTilledSoilGrowthBonus.getBoolean();

    config.save();
}
 
源代码7 项目: OpenModsLib   文件: ConfigurableFeatureManager.java
public Table<String, String, Property> loadFromConfiguration(Configuration config) {
	final Table<String, String, Property> properties = HashBasedTable.create();
	for (Table.Cell<String, String, FeatureEntry> cell : features.cellSet()) {
		final FeatureEntry entry = cell.getValue();
		if (!entry.isConfigurable) continue;

		final String categoryName = cell.getRowKey();
		final String featureName = cell.getColumnKey();
		final Property prop = config.get(categoryName, featureName, entry.isEnabled);
		properties.put(categoryName, featureName, prop);
		if (!prop.wasRead()) continue;

		if (!prop.isBooleanValue()) prop.set(entry.isEnabled);
		else entry.isEnabled = prop.getBoolean(entry.isEnabled);
	}

	return ImmutableTable.copyOf(properties);
}
 
源代码8 项目: OpenModsLib   文件: OpenModsConfigScreen.java
protected static IConfigElement createFeatureEntries(String modId) {
	final AbstractFeatureManager manager = FeatureRegistry.instance.getManager(modId);
	if (manager == null) return null;

	final List<IConfigElement> categories = Lists.newArrayList();

	for (String category : manager.getCategories()) {
		List<IConfigElement> categoryEntries = Lists.newArrayList();
		for (String feature : manager.getFeaturesInCategory(category)) {
			final Property property = FeatureRegistry.instance.getProperty(modId, category, feature);
			if (property != null) categoryEntries.add(new ConfigElement(property));
		}

		categories.add(new CategoryElement(category, "openmodslib.config.features." + category, categoryEntries));
	}

	return new CategoryElement("features", "openmodslib.config.features", categories);
}
 
源代码9 项目: LookingGlass   文件: ModConfigs.java
public static void loadConfigs(Configuration config) {
	Property off = config.get(CATAGORY_SERVER, "disabled", disabled);
	off.comment = "On the client this disables other world renders entirely, preventing world requests. On the server this disables sending world info to all clients.";
	disabled = off.getBoolean(disabled);

	Property d = config.get(CATAGORY_SERVER, "datarate", dataRate);
	d.comment = "The number of bytes to send per tick before the server cuts off sending. Only applies to other-world chunks. Default: " + dataRate;
	dataRate = d.getInt(dataRate);

	if (dataRate <= 0) disabled = true;

	if (config.hasChanged()) config.save();
}
 
源代码10 项目: Levels   文件: Config.java
private static void syncMain()
{
	String category = "main";
	List<String> propOrder = Lists.newArrayList();
	Property prop;
	
	/*
	 * Experience
	 */
	prop = main.get(category, "maxLevel", maxLevel);
	prop.setComment("Determines the max level of weapons and armor.");
	maxLevel = prop.getDouble();
	propOrder.add(prop.getName());
	
	prop = main.get(category, "experienceExponent", expExponent);
	prop.setComment("Sets the exponent of the experience algorithm.");
	expExponent = prop.getDouble();
	propOrder.add(prop.getName());
	
	prop = main.get(category, "experienceMultiplier", expMultiplier);
	prop.setComment("Sets the multiplier of the experience algorithm.");
	expMultiplier = prop.getInt();
	propOrder.add(prop.getName());
	
	/*
	 * Miscellaneous
	 */
	prop = main.get(category, "itemBlacklist", itemBlacklist);
	prop.setComment("Items in this blacklist will not gain the leveling systems. Useful for very powerful items or potential conflicts. Style should be 'modid:item'");
	itemBlacklist = prop.getStringList();
	propOrder.add(prop.getName());
	
	prop = main.get(category, "unlimitedDurability", unlimitedDurability);
	prop.setComment("Determines whether or not weapons and armor will lose durability.");
	unlimitedDurability = prop.getBoolean();
	propOrder.add(prop.getName());
	
	main.setCategoryPropertyOrder(category, propOrder);
	main.save();
}
 
源代码11 项目: TFC2   文件: TFCOptions.java
public static boolean getBooleanFor(Configuration config,String heading, String item, boolean value)
{
	if (config == null)
		return value;
	try
	{
		Property prop = config.get(heading, item, value);
		return prop.getBoolean(value);
	}
	catch (Exception e)
	{
		System.out.println("[TFC2] Error while trying to add Integer, config wasn't loaded properly!");
	}
	return value;
}
 
源代码12 项目: TFC2   文件: TFCOptions.java
public static int getIntFor(Configuration config, String heading, String item, int value)
{
	if (config == null)
		return value;
	try
	{
		Property prop = config.get(heading, item, value);
		return prop.getInt(value);
	}
	catch (Exception e)
	{
		System.out.println("[TFC2] Error while trying to add Integer, config wasn't loaded properly!");
	}
	return value;
}
 
源代码13 项目: TFC2   文件: TFCOptions.java
public static String getStringFor(Configuration config, String heading, String item, String value)
{
	if (config == null)
		return value;
	try
	{
		Property prop = config.get(heading, item, value);
		return prop.getString();
	} catch (Exception e)
	{
		System.out.println("[TFC2] Error while trying to add String, config wasn't loaded properly!");
	}
	return value;
}
 
源代码14 项目: TFC2   文件: TFCOptions.java
public static String getStringFor(Configuration config, String heading, String item, String value, String comment)
{
	if (config == null)
		return value;
	try
	{
		Property prop = config.get(heading, item, value);
		prop.setComment(comment);
		return prop.getString();
	} catch (Exception e)
	{
		System.out.println("[TFC2] Error while trying to add String, config wasn't loaded properly!");
	}
	return value;
}
 
源代码15 项目: enderutilities   文件: ConfigReader.java
private static Property getProp(String category, String key, boolean defaultValue, boolean requiresMcRestart)
{
    VALID_CATEGORIES.add(category);
    Property prop = config.get(category, key, defaultValue).setRequiresMcRestart(requiresMcRestart);
    VALID_CONFIGS.add(category + "_" + key);
    return prop;
}
 
源代码16 项目: enderutilities   文件: ConfigReader.java
private static Property getProp(String category, String key, int defaultValue, boolean requiresMcRestart)
{
    VALID_CATEGORIES.add(category);
    Property prop = config.get(category, key, defaultValue).setRequiresMcRestart(requiresMcRestart);
    VALID_CONFIGS.add(category + "_" + key);
    return prop;
}
 
源代码17 项目: enderutilities   文件: ConfigReader.java
private static Property getProp(String category, String key, double defaultValue, boolean requiresMcRestart)
{
    VALID_CATEGORIES.add(category);
    Property prop = config.get(category, key, defaultValue).setRequiresMcRestart(requiresMcRestart);
    VALID_CONFIGS.add(category + "_" + key);
    return prop;
}
 
源代码18 项目: enderutilities   文件: ConfigReader.java
private static Property getProp(String category, String key, String defaultValue, boolean requiresMcRestart)
{
    VALID_CATEGORIES.add(category);
    Property prop = config.get(category, key, defaultValue).setRequiresMcRestart(requiresMcRestart);
    VALID_CONFIGS.add(category + "_" + key);
    return prop;
}
 
源代码19 项目: enderutilities   文件: ConfigReader.java
private static Property getProp(String category, String key, String[] defaultValue, boolean requiresMcRestart)
{
    VALID_CATEGORIES.add(category);
    Property prop = config.get(category, key, defaultValue).setRequiresMcRestart(requiresMcRestart);
    VALID_CONFIGS.add(category + "_" + key);
    return prop;
}
 
源代码20 项目: GardenCollection   文件: ConfigManager.java
public ConfigManager (File file) {
    config = new Configuration(file);

    Property propStrangePlantDrops = config.get(Configuration.CATEGORY_GENERAL, "strangePlantDrops", new String[0]);
    propStrangePlantDrops.comment = "A list of zero or more item IDs.  Breaking the plant will drop an item picked at random from the list.  Ex: minecraft:coal:1";

    Property propStrangePlantDropChance = config.get(Configuration.CATEGORY_GENERAL, "strangePlantDropChance", 1.0);
    propStrangePlantDropChance.comment = "The probability from 0.0 - 1.0 that breaking a strange plant will drop its contents.";
    strangePlantDropChance = propStrangePlantDropChance.getDouble();

    Property propStrangePlantDropMin = config.get(Configuration.CATEGORY_GENERAL, "strangePlantDropMin", 1);
    propStrangePlantDropMin.comment = "The minimum number of items dropped when breaking a strange plant.";
    strangePlantDropMin = propStrangePlantDropMin.getInt();

    Property propStrangePlantDropMax = config.get(Configuration.CATEGORY_GENERAL, "strangePlantDropMax", 1);
    propStrangePlantDropMax.comment = "The maximum number of items dropped when breaking a strange plant.";
    strangePlantDropMax = propStrangePlantDropMax.getInt();

    Property propCompostGrowsOrnamentalTrees = config.get(Configuration.CATEGORY_GENERAL, "compostGrowsOrnamentalTrees", true);
    propCompostGrowsOrnamentalTrees.comment = "Using compost on saplings will grow ornamental (miniature) trees instead of normal trees.";
    compostGrowsOrnamentalTrees = propCompostGrowsOrnamentalTrees.getBoolean();

    Property propGenerateCandelilla = config.get(Configuration.CATEGORY_GENERAL, "generateCandelilla", true);
    propGenerateCandelilla.comment = "Generates clusters of candelilla shrub in warm, sandy biomes.";
    generateCandelilla = propGenerateCandelilla.getBoolean();

    config.save();
}
 
源代码21 项目: GardenCollection   文件: ConfigManager.java
private void parseStrangePlantItems (Property property) {
    String[] entries = property.getStringList();
    if (entries == null || entries.length == 0) {
        strangePlantDrops = new ItemStack[0];
        return;
    }

    List<ItemStack> results = new ArrayList<ItemStack>();

    for (String entry : entries) {
        UniqueMetaIdentifier uid = new UniqueMetaIdentifier(entry);
        int meta = (uid.meta == OreDictionary.WILDCARD_VALUE) ? 0 : uid.meta;

        Item item = GameRegistry.findItem(uid.modId, uid.name);
        if (item != null) {
            results.add(new ItemStack(item, 1, meta));
            continue;
        }

        Block block = GameRegistry.findBlock(uid.modId, uid.name);
        if (block != null) {
            item = Item.getItemFromBlock(block);
            if (item != null) {
                results.add(new ItemStack(item, 1, meta));
                continue;
            }
        }
    }

    strangePlantDrops = new ItemStack[results.size()];
    for (int i = 0; i < results.size(); i++)
        strangePlantDrops[i] = results.get(i);
}
 
源代码22 项目: GardenCollection   文件: ConfigManager.java
public ItemStack[] getStrangePlantDrops () {
    if (strangePlantDrops == null) {
        Property propStrangePlantDrops = config.get(Configuration.CATEGORY_GENERAL, "strangePlantDrops", new String[0]);
        parseStrangePlantItems(propStrangePlantDrops);
    }

    return strangePlantDrops;
}
 
源代码23 项目: MediaMod   文件: Settings.java
private static void updateConfig(Configuration configuration, boolean load) {
    Property enabledProperty = configuration.get("General", "enabled", true);
    Property showPlayerProperty = configuration.get("General", "showPlayer", true);
    Property modernPlayerProperty = configuration.get("Player", "modernPlayer", true);
    Property albumArtProperty = configuration.get("Player", "showAlbumArt", true);
    Property autoColorProperty = configuration.get("Player", "automaticColorSelection", true);
    Property saveSpotifyTokenProperty = configuration.get("General", "saveSpotifyToken", true);
    Property announceTracksProperty = configuration.get("Player", "announceTracks", true);
    Property playerXProperty = configuration.get("Player", "playerX", 5.0);
    Property playerYProperty = configuration.get("Player", "playerY", 5.0);
    Property playerZoomProperty = configuration.get("Player", "playerZoom", 1.0);
    Property browserExtProperty = configuration.get("Player", "useBrowserExtension", true);
    Property progressStyleProperty = configuration.get("Player", "progressStyle", ProgressStyle.BAR_AND_NUMBERS_NEW.name());
    Property refreshTokenProperty = configuration.get("Spotify", "refreshToken", "");

    if (load) SAVE_SPOTIFY_TOKEN = saveSpotifyTokenProperty.getBoolean();
    else saveSpotifyTokenProperty.setValue(SAVE_SPOTIFY_TOKEN);

    if (load) REFRESH_TOKEN = refreshTokenProperty.getString();
    else {
        if(SAVE_SPOTIFY_TOKEN) {
            refreshTokenProperty.setValue(REFRESH_TOKEN);
        } else {
            refreshTokenProperty.setValue("");
        }
    }

    if (load) ENABLED = enabledProperty.getBoolean();
    else enabledProperty.setValue(ENABLED);

    if (load) ANNOUNCE_TRACKS = announceTracksProperty.getBoolean();
    else announceTracksProperty.setValue(ANNOUNCE_TRACKS);

    if (load) PROGRESS_STYLE = ProgressStyle.valueOf(progressStyleProperty.getString());
    else progressStyleProperty.setValue(PROGRESS_STYLE.name());

    if (load) SHOW_PLAYER = showPlayerProperty.getBoolean();
    else showPlayerProperty.setValue(SHOW_PLAYER);

    if (load) MODERN_PLAYER_STYLE = modernPlayerProperty.getBoolean();
    else modernPlayerProperty.setValue(MODERN_PLAYER_STYLE);

    if (load) SHOW_ALBUM_ART = albumArtProperty.getBoolean();
    else albumArtProperty.setValue(SHOW_ALBUM_ART);

    if (load) AUTO_COLOR_SELECTION = autoColorProperty.getBoolean();
    else autoColorProperty.setValue(AUTO_COLOR_SELECTION);

    if (load) PLAYER_X = playerXProperty.getDouble();
    else playerXProperty.setValue(PLAYER_X);

    if (load) PLAYER_Y = playerYProperty.getDouble();
    else playerYProperty.setValue(PLAYER_Y);

    if (load) PLAYER_ZOOM = playerZoomProperty.getDouble();
    else playerZoomProperty.setValue(PLAYER_ZOOM);

    if (load) EXTENSION_ENABLED = browserExtProperty.getBoolean();
    else browserExtProperty.setValue(EXTENSION_ENABLED);
}
 
源代码24 项目: CommunityMod   文件: CommunityConfig.java
public Property getSubModEnabled(SubModContainer container)
{
    return config.get(container.getId(), "_submods", container.getSubMod().enabledByDefault(), container.getDescription() + " Author: " + container.getAttribution());
}
 
源代码25 项目: mobycraft   文件: ConfigProperties.java
public Property getCertPathProperty() {
	return certPathProperty;
}
 
源代码26 项目: mobycraft   文件: ConfigProperties.java
public void setCertPathProperty(Property certPathProperty) {
	this.certPathProperty = certPathProperty;
}
 
源代码27 项目: mobycraft   文件: ConfigProperties.java
public Property getDockerHostProperty() {
	return dockerHostProperty;
}
 
源代码28 项目: mobycraft   文件: ConfigProperties.java
public void setDockerHostProperty(Property dockerHostProperty) {
	this.dockerHostProperty = dockerHostProperty;
}
 
源代码29 项目: mobycraft   文件: ConfigProperties.java
public Property getStartPosProperty() {
	return startPosProperty;
}
 
源代码30 项目: mobycraft   文件: ConfigProperties.java
public void setStartPosProperty(Property startPosProperty) {
	this.startPosProperty = startPosProperty;
}