use of net.minecraftforge.common.config.Configuration in project RFToolsDimensions by McJty.
the class CommonProxy method preInit.
public void preInit(FMLPreInitializationEvent e) {
GeneralConfig.preInit(e);
modConfigDir = e.getModConfigurationDirectory();
mainConfig = new Configuration(new File(modConfigDir.getPath() + File.separator + "rftools", "dimensions.cfg"));
readMainConfig();
SimpleNetworkWrapper network = PacketHandler.registerMessages(RFToolsDim.MODID, "rftoolsdim");
RFToolsDimMessages.registerNetworkMessages(network);
ModItems.init();
ModBlocks.init();
ModDimensions.init();
DimletRules.readRules(modConfigDir);
}
use of net.minecraftforge.common.config.Configuration in project RFToolsDimensions by McJty.
the class CommonProxy method readMainConfig.
private void readMainConfig() {
Configuration cfg = mainConfig;
try {
cfg.load();
cfg.addCustomCategoryComment(GeneralConfiguration.CATEGORY_GENERAL, "Dimension related settings");
cfg.addCustomCategoryComment(MachineConfiguration.CATEGORY_MACHINES, "Machine related settings");
cfg.addCustomCategoryComment(WorldgenConfiguration.CATEGORY_WORLDGEN, "Worldgen related settings");
cfg.addCustomCategoryComment(PowerConfiguration.CATEGORY_POWER, "Power related settings");
cfg.addCustomCategoryComment(DimletConfiguration.CATEGORY_DIMLETS, "Dimlet related settings");
cfg.addCustomCategoryComment(MobConfiguration.CATEGORY_MOBS, "Mob related settings");
cfg.addCustomCategoryComment(OresAPlentyConfiguration.CATEGORY_ORESAPLENTY, "Settings for the OresAPlenty dimlet");
cfg.addCustomCategoryComment(DimletConstructionConfiguration.CATEGORY_DIMLET_CONSTRUCTION, "Dimlet construction related settings");
cfg.addCustomCategoryComment(LostCityConfiguration.CATEGORY_LOSTCITY, "Settings related to the Lost City dimlet");
GeneralConfiguration.init(cfg);
MachineConfiguration.init(cfg);
WorldgenConfiguration.init(cfg);
PowerConfiguration.init(cfg);
DimletConfiguration.init(cfg);
MobConfiguration.init(cfg);
OresAPlentyConfiguration.init(cfg);
LostCityConfiguration.init(cfg);
DimletConstructionConfiguration.init(cfg);
} catch (Exception e1) {
FMLLog.log(Level.ERROR, e1, "Problem loading config file!");
} finally {
if (mainConfig.hasChanged()) {
mainConfig.save();
}
}
}
use of net.minecraftforge.common.config.Configuration in project OpenLights by PC-Logix.
the class OpenLights method preInit.
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
cfg = new Config(new Configuration(event.getSuggestedConfigurationFile()));
if ((event.getSourceFile().getName().endsWith(".jar") || debug) && event.getSide().isClient() && cfg.enableMUD) {
try {
Class.forName("pcl.openprinter.mud.ModUpdateDetector").getDeclaredMethod("registerMod", ModContainer.class, URL.class, URL.class).invoke(null, FMLCommonHandler.instance().findContainerFor(this), new URL("http://PC-Logix.com/OpenLights/get_latest_build.php"), new URL("http://PC-Logix.com/OpenLights/changelog.txt"));
} catch (Throwable e) {
//e.printStackTrace();
}
}
//GameRegistry.registerBlock(openLightBlock, "openlights.openlight");
GameRegistry.registerBlock(openLightBlock, MultiItemBlock.class, "openlights.openlight");
for (int ix = 0; ix < 16; ix++) {
ItemStack multiBlockStack = new ItemStack(openLightBlock, 1, ix);
}
GameRegistry.registerTileEntity(OpenLightTE.class, "OpenLightTE");
//openLightBlock.setCreativeTab(li.cil.oc.api.CreativeTab.instance);
prismaticPaste = new PrismaticPaste();
GameRegistry.registerItem(prismaticPaste, "openlights.prismaticPaste");
}
use of net.minecraftforge.common.config.Configuration in project Realistic-Terrain-Generation by Team-RTG.
the class Config method load.
public void load(String configFile) {
Configuration config = new Configuration(new File(configFile));
try {
config.load();
ArrayList<ConfigProperty> properties = this.getProperties();
for (int j = 0; j < properties.size(); j++) {
ConfigProperty prop = properties.get(j);
switch(prop.type) {
case INTEGER:
ConfigPropertyInt propInt = (ConfigPropertyInt) properties.get(j);
propInt.set(config.getInt(propInt.name, propInt.category, propInt.valueInt, propInt.minValueInt, propInt.maxValueInt, prop.description));
break;
case FLOAT:
ConfigPropertyFloat propFloat = (ConfigPropertyFloat) properties.get(j);
propFloat.set(config.getFloat(propFloat.name, propFloat.category, propFloat.valueFloat, propFloat.minValueFloat, propFloat.maxValueFloat, propFloat.description));
break;
case BOOLEAN:
ConfigPropertyBoolean propBool = (ConfigPropertyBoolean) properties.get(j);
propBool.set(config.getBoolean(propBool.name, propBool.category, propBool.valueBoolean, propBool.description));
break;
case STRING:
ConfigPropertyString propString = (ConfigPropertyString) properties.get(j);
propString.set(config.getString(propString.name, propString.category, propString.valueString, propString.description));
break;
default:
throw new RuntimeException("ConfigProperty type not supported.");
}
}
} catch (Exception e) {
FMLLog.log(Level.ERROR, "[RTG-ERROR] RTG had a problem loading config: %s", configFile);
} finally {
if (config.hasChanged()) {
config.save();
}
}
}
use of net.minecraftforge.common.config.Configuration in project Guide-API by TeamAmeriFrance.
the class ConfigHandler method init.
public static void init(File file) {
config = new Configuration(file);
syncConfig();
}
Aggregations