Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ====CONFIGURATIONHANDLER====
- package com.nexunuke.testmod.configuration;
- import net.minecraftforge.common.config.Configuration;
- import java.io.File;
- public class ConfigurationHandler {
- public static void init(File configFile){
- //Create the configuration object from the given configuration file
- Configuration configuration = new Configuration();
- try{
- //Load the configuration file
- configuration.load();
- //Read in properties from configuration file
- boolean configValue = configuration.get(Configuration.CATEGORY_GENERAL, "configValue", true, "This is an example config value").getBoolean(true);
- }
- catch(Exception e){
- //Log the configuration file
- }
- finally {
- //Save the configuration file
- configuration.save();
- }
- }
- }
- ====MAIN CLASS====
- package com.nexunuke.testmod;
- import com.nexunuke.testmod.configuration.ConfigurationHandler;
- import com.nexunuke.testmod.proxy.IProxy;
- import com.nexunuke.testmod.reference.Reference;
- import cpw.mods.fml.common.Mod;
- import cpw.mods.fml.common.SidedProxy;
- import cpw.mods.fml.common.event.FMLInitializationEvent;
- import cpw.mods.fml.common.event.FMLPostInitializationEvent;
- import cpw.mods.fml.common.event.FMLPreInitializationEvent;
- @Mod(modid= Reference.MOD_ID, name= Reference.MOD_NAME, version= Reference.VERSION)
- public class TestMod
- {
- @Mod.Instance(Reference.MOD_ID)
- public static TestMod instance;
- @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
- public static IProxy proxy;
- @Mod.EventHandler
- public void preInit(FMLPreInitializationEvent event)
- {
- ConfigurationHandler.init(event.getSuggestedConfigurationFile());
- }
- @Mod.EventHandler
- public void init(FMLInitializationEvent event)
- {
- }
- @Mod.EventHandler
- public void postInit(FMLPostInitializationEvent event)
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement