Search in sources :

Example 11 with Property

use of net.minecraftforge.common.config.Property in project Railcraft by Railcraft.

the class RailcraftConfig method loadItems.

private static void loadItems() {
    configItems.addCustomCategoryComment(CAT_ITEMS, "Many items can be disabled by setting them to 'false'.\n" + "This is not true for all items, so some experimentation may be needed.\n" + "Some disabled items will cause a substitute to be used in crafting recipes.");
    for (RailcraftItems item : RailcraftItems.VALUES) {
        loadItemProperty(item.getBaseTag());
    }
    Map<String, Property> items = configItems.getCategory(CAT_ITEMS);
    items.keySet().retainAll(enabledItems.keySet());
//        loadItemProperty("tool.crowbar.magic");
//        loadItemProperty("tool.crowbar.void");
//        loadItemProperty("backpack.trackman.t1");
//        loadItemProperty("backpack.trackman.t2");
//        loadItemProperty("backpack.iceman.t1");
//        loadItemProperty("backpack.iceman.t2");
//        loadItemProperty("backpack.apothecary.t1");
//        loadItemProperty("backpack.apothecary.t2");
//
//        loadItemProperty("fluid.steam.bottle");
//        loadItemProperty("fluid.creosote.cell");
//        loadItemProperty("fluid.creosote.bottle");
//        loadItemProperty("fluid.creosote.can");
//        loadItemProperty("fluid.creosote.wax");
//        loadItemProperty("fluid.creosote.refactory");
//        loadItemProperty("fluid.creosote.bucket");
//
//        loadItemProperty("firestone.cut");
//        loadItemProperty("firestone.raw");
//        loadItemProperty("firestone.refined");
//        loadItemProperty("firestone.cracked");
//
//        loadItemProperty("tool.steel.shears");
//        loadItemProperty("tool.steel.sword");
//        loadItemProperty("tool.steel.shovel");
//        loadItemProperty("tool.steel.pickaxe");
//        loadItemProperty("tool.steel.axe");
//        loadItemProperty("tool.steel.hoe");
//
//        loadItemProperty("armor.steel.helmet");
//        loadItemProperty("armor.steel.plate");
//        loadItemProperty("armor.steel.legs");
//        loadItemProperty("armor.steel.boots");
//
//        changeItemProperty("item.ic2.upgrade.lapotron", "ic2.upgrade.lapotron");
//
//        loadItemProperty("tool.bore.head.diamond");
//        loadItemProperty("tool.bore.head.iron");
//        loadItemProperty("tool.bore.head.steel");
//
//        changeItemProperty("item.cart.tnt", "cart.tnt");
//        loadItemProperty("cart.tnt.wood");
//        changeItemProperty("item.cart.pumpkin", "cart.pumpkin");
//        changeItemProperty("item.cart.gift", "cart.gift");
//
//        changeItemProperty("item.cart.tank", "cart.tank");
//        changeItemProperty("item.cart.bore", "cart.bore");
//
//        loadItemProperty("cart.energy.batbox");
//        loadItemProperty("cart.energy.cesu");
//        loadItemProperty("cart.energy.mfe");
//        loadItemProperty("cart.energy.mfsu");
//
//        changeItemProperty("item.cart.worldspike", "cart.worldspike");
//        changeItemProperty("item.cart.worldspike.personal", "cart.worldspike.personal");
//        changeItemProperty("item.cart.worldspike.admin", "cart.worldspike.admin");
//        changeItemProperty("item.cart.work", "cart.work");
//        changeItemProperty("item.cart.track.relayer", "cart.track.relayer");
//        changeItemProperty("item.cart.undercutter", "cart.undercutter");
//
//        changeItemProperty("cart.loco.steam", "cart.loco.steam.solid");
//
//        loadItemProperty("emblem");
}
Also used : RailcraftItems(mods.railcraft.common.items.RailcraftItems) Property(net.minecraftforge.common.config.Property)

Example 12 with Property

use of net.minecraftforge.common.config.Property in project Railcraft by Railcraft.

the class RailcraftConfig method getIntegerList.

private static List<Integer> getIntegerList(String cat, String tag, int maxEntries) {
    Property prop = configMain.get(cat, tag, "");
    String value = prop.getString();
    if (value.equals(""))
        return Collections.emptyList();
    String[] tokens = value.split(",");
    List<Integer> list = new ArrayList<Integer>(maxEntries);
    int count = 0;
    for (String token : tokens) {
        list.add(Integer.valueOf(token));
        count++;
        if (count >= maxEntries)
            break;
    }
    return list;
}
Also used : Property(net.minecraftforge.common.config.Property)

Example 13 with Property

use of net.minecraftforge.common.config.Property in project Railcraft by Railcraft.

the class RailcraftConfig method loadEntityProperty.

private static void loadEntityProperty(String tag) {
    Map<String, Property> items = configEntity.getCategory(CAT_ENTITIES);
    Property prop = items.remove("entity_" + tag);
    if (prop != null) {
        prop.setName(tag);
        items.put(tag, prop);
    }
    prop = configEntity.get(CAT_ENTITIES, tag, true);
    entities.put(tag, prop.getBoolean(true));
}
Also used : Property(net.minecraftforge.common.config.Property)

Example 14 with Property

use of net.minecraftforge.common.config.Property in project Railcraft by Railcraft.

the class RailcraftConfig method get.

private static String[] get(String category, String tag, String[] defaultValues, String comment) {
    Property property = configMain.get(category, tag, defaultValues, comment);
    decorateComment(property, tag, comment);
    return property.getStringList();
}
Also used : Property(net.minecraftforge.common.config.Property)

Example 15 with Property

use of net.minecraftforge.common.config.Property in project Railcraft by Railcraft.

the class RailcraftConfig method get.

private static int get(Configuration config, String cat, String tag, int min, int defaultValue, int max, String comment) {
    Property prop = config.get(cat, tag, defaultValue);
    decorateComment(prop, tag, comment);
    int parsed = parseInteger(prop, defaultValue);
    int clamped = Math.max(parsed, min);
    clamped = Math.min(clamped, max);
    if (clamped != parsed)
        prop.set(clamped);
    return clamped;
}
Also used : Property(net.minecraftforge.common.config.Property)

Aggregations

Property (net.minecraftforge.common.config.Property)50 ArrayList (java.util.ArrayList)8 File (java.io.File)2 Configuration (net.minecraftforge.common.config.Configuration)2 AMVector2 (am2.api.math.AMVector2)1 IOException (java.io.IOException)1 Date (java.util.Date)1 IRailcraftModule (mods.railcraft.api.core.IRailcraftModule)1 IVariantEnum (mods.railcraft.api.core.IVariantEnum)1 RailcraftModule (mods.railcraft.api.core.RailcraftModule)1 RailcraftBlocks (mods.railcraft.common.blocks.RailcraftBlocks)1 TrackKits (mods.railcraft.common.blocks.tracks.outfitted.TrackKits)1 RailcraftItems (mods.railcraft.common.items.RailcraftItems)1 ItemMap (mods.railcraft.common.util.collections.ItemMap)1 ConfigCategory (net.minecraftforge.common.config.ConfigCategory)1 ModContainer (net.minecraftforge.fml.common.ModContainer)1