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);
}
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;
}
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;
}
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));
}
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);
}
}
}
Aggregations