Java Code Examples for net.minecraftforge.common.config.Property#getStringList()

The following examples show how to use net.minecraftforge.common.config.Property#getStringList() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Config.java    From Levels with GNU General Public License v2.0 5 votes vote down vote up
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();
}
 
Example 2
Source File: ConfigManager.java    From GardenCollection with MIT License 5 votes vote down vote up
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);
}
 
Example 3
Source File: ConfigReader.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
private static void loadConfigLists(Configuration conf)
{
    Property prop;

    currentRequiresMcRestart = false;
    currentCategory = CATEGORY_LISTS;

    prop = getProp("dollyBlockBlacklist", new String[0]);
    prop.setComment("A list of blockstates that are not allowed to be picked up\nby the Dolly (only effective in survival mode!)\n" +
                    "Use a blockstate string, for example:\n'minecraft:gold_block' or 'minecraft:stone[variant=andesite]'.\n" +
                    "A block name without properties will match all states,\nfor example: 'minecraft:stone'\n" +
                    "would match smooth stone and all the granite/andesite/diorite\nvariants that are in the same block.");
    Configs.dollyBlockBlacklist = prop.getStringList();

    prop = getProp("energyBridgeBedrockWhitelist", new String[] { "minecraft:bedrock" });
    prop.setComment("A list of blockstates that are valid for the Energy Bridge's Bedrock requirement.\n" +
                    "Use a blockstate string, for example: 'minecraft:gold_block' or 'minecraft:stone[variant=andesite]'.\n" +
                    "A block name without properties will match all states, for example: 'minecraft:stone'\n" +
                    "would match smooth stone and all the granite/andesite/diorite variants that are in the same block.");
    Configs.energyBridgeBedrockWhitelist = prop.getStringList();
    
    prop = getProp("endDimensions", new String[0]);
    prop.setComment("A list of dimension IDs that should be considered End dimensions, although they may otherwise not seem like it.\n" +
                    "This is mainly used for the Energy Bridges, to allow the Transmitters to work in custom End dimensions.");
    Configs.endDimensions = prop.getStringList();

    prop = getProp("enderBagListType", "whitelist");
    prop.setComment("Target control list type used for Ender Bag. Allowed values: blacklist, whitelist.");
    Configs.enderBagListTypeIsWhitelist = prop.getString().equalsIgnoreCase("whitelist");

    prop = getProp("enderBagBlackList", new String[0]);
    prop.setComment("Block types the Ender Bag is NOT allowed to (= doesn't properly) work with.");
    Configs.enderBagBlacklist = prop.getStringList();

    prop = getProp("enderBagWhiteList",
            new String[] {
                    "minecraft:chest",
                    "minecraft:dispenser",
                    "minecraft:dropper",
                    "minecraft:ender_chest",
                    "minecraft:furnace",
                    "minecraft:hopper",
                    "minecraft:trapped_chest"
                    });
    prop.setComment("Block types the Ender Bag is allowed to (= should properly) work with. **NOTE** Only some vanilla blocks work properly atm!!");
    Configs.enderBagWhitelist = prop.getStringList();

    prop = getProp("livingMatterManipulatorListType", "blacklist");
    prop.setComment("The list type used for the Living Matter Manipulator. Allowed values: blacklist, whitelist.");
    Configs.lmmListIsWhitelist = prop.getString().equalsIgnoreCase("whitelist");

    prop = getProp("livingMatterManipulatorBlackList",
            new String[] {
                    "minecraft:ender_dragon",
                    "minecraft:wither"
                    });
    prop.setComment("List of entity names the LMM is not allowed to store, if 'livingMatterManipulatorListType' is 'blacklist'.");
    Configs.lmmBlacklist = prop.getStringList();

    prop = getProp("livingMatterManipulatorWhiteList", new String[] {});
    prop.setComment("List of entity names the LMM is only allowed to store, if 'livingMatterManipulatorListType' is 'whitelist'.");
    Configs.lmmWhitelist = prop.getStringList();

    prop = getProp("teleportBlackList",
            new String[] {
                    "minecraft:ender_dragon",
                    "minecraft:ender_crystal",
                    "minecraft:wither"
                    });
    prop.setComment("Entities that are not allowed to be teleported using any methods");
    Configs.teleportBlacklist = prop.getStringList();

    BlackLists.registerDollyBlacklist(Configs.dollyBlockBlacklist);
    BlackLists.registerEnergyBridgeBedrockWhitelist(Configs.energyBridgeBedrockWhitelist);
    BlackLists.registerEnderBagLists(Configs.enderBagBlacklist, Configs.enderBagWhitelist);
    BlackLists.registerTeleportBlacklist(Configs.teleportBlacklist);
    WorldUtils.setCustomEndDimensions(Configs.endDimensions);
}