Search in sources :

Example 6 with Property

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

the class RailcraftModuleManager method isConfigured.

private static boolean isConfigured(Configuration config, IRailcraftModule m) {
    RailcraftModule annotation = m.getClass().getAnnotation(RailcraftModule.class);
    String moduleName = annotation.value().toLowerCase(Locale.ENGLISH);
    // oops, remove this later
    config.renameProperty(CATEGORY_MODULES, moduleName.replaceAll("[_|]", "."), moduleName);
    Property prop = config.get(CATEGORY_MODULES, moduleName, true, annotation.description());
    return prop.getBoolean(true);
}
Also used : RailcraftModule(mods.railcraft.api.core.RailcraftModule) IRailcraftModule(mods.railcraft.api.core.IRailcraftModule) Property(net.minecraftforge.common.config.Property)

Example 7 with Property

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

the class RailcraftConfig method get.

private static Property get(String cat, String tag, String defaultValue, String comment) {
    Property prop = configMain.get(cat, tag, defaultValue);
    decorateComment(prop, tag, comment);
    return prop;
}
Also used : Property(net.minecraftforge.common.config.Property)

Example 8 with Property

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

the class RailcraftConfig method get.

private static boolean get(String cat, String tag, boolean defaultValue, boolean reset, String comment) {
    Property prop = configMain.get(cat, tag, defaultValue);
    decorateComment(prop, tag, comment);
    boolean ret = prop.getBoolean(defaultValue);
    if (reset)
        prop.set(defaultValue);
    return ret;
}
Also used : Property(net.minecraftforge.common.config.Property)

Example 9 with Property

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

the class RailcraftConfig method loadBlockFeature.

private static void loadBlockFeature(String tag) {
    tag = MiscTools.cleanTag(tag);
    cleanOldTags(configBlocks.getCategory(CAT_SUB_BLOCKS), tag);
    Property prop = configBlocks.get(CAT_SUB_BLOCKS, tag, true);
    enabledSubBlocks.put(tag, prop.getBoolean(true));
}
Also used : Property(net.minecraftforge.common.config.Property)

Example 10 with Property

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

the class RailcraftConfig method cleanOldTags.

private static void cleanOldTags(Map<String, Property> props, String tag) {
    String oldTag = null;
    for (Map.Entry<String, Property> entry : props.entrySet()) {
        String thisTag = entry.getKey();
        if (thisTag.replaceAll("[_.]", "").equals(tag.replaceAll("[_.]", "")) && thisTag.contains(".")) {
            oldTag = entry.getKey();
            break;
        }
    }
    if (oldTag != null) {
        Property prop = props.remove(oldTag);
        if (prop != null) {
            prop.setName(tag);
            props.put(tag, prop);
        }
    }
}
Also used : ItemMap(mods.railcraft.common.util.collections.ItemMap) 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