package reborncore.common;

import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.Loader;

import java.io.File;

/**
 * Created by Mark on 20/02/2016.
 */
public class RebornCoreConfig {

    public static Configuration config;

    private static RebornCoreConfig instance = null;
    public static String CATEGORY_POWER = "power";

    public static boolean enableRF;
    public static boolean enableEU;
    public static int euPerRF;

    public RebornCoreConfig(File configFile) {
        config = new Configuration(configFile);
        config.load();

        RebornCoreConfig.Configs();

        config.save();
    }

    public static RebornCoreConfig initialize(File configFile) {

        if (instance == null)
            instance = new RebornCoreConfig(configFile);
        else
            throw new IllegalStateException("Cannot initialize TechReborn Config twice");

        return instance;
    }

    public static RebornCoreConfig instance() {
        if (instance == null) {

            throw new IllegalStateException("Instance of TechReborn Config requested before initialization");
        }
        return instance;
    }

    public static void Configs() {
        enableRF = config
                .get(CATEGORY_POWER, "Allow RF", !Loader.isModLoaded("IC2"), "Allow machines to be powered with RF")
                .getBoolean();

        enableEU = config
                .get(CATEGORY_POWER, "Allow EU", Loader.isModLoaded("IC2"), "Allow machines to be powered with EU")
                .getBoolean();

        euPerRF = config.get(CATEGORY_POWER, "EU - RF ratio", 4, "The Amount of RF to output from EU").getInt();
    }
}

@@ -1291,34 +1291,13 @@
 F%22, 
-!Loader.isModLoaded(%22IC2%22)
+false
 , %22A
@@ -1358,32 +1358,34 @@
 .getBoolean();%0A%0A
+//
         enableEU
@@ -1386,32 +1386,34 @@
 ableEU = config%0A
+//
                 
@@ -1512,16 +1512,18 @@
 th EU%22)%0A
+//
         
@@ -1544,16 +1544,41 @@
 olean();
+%0A        enableEU = true;
 %0A%0A      

Update default Configs