package ncrashed.warp;

import java.io.File;
import java.io.IOException;

import ncrashed.registration.CommonProxy;
import net.minecraftforge.common.Configuration;

public class BlockIdConfig 
{
	public static final String CONFIG_NAME = "WarpBlocks.cfg";
	
	public int mMarkerBlockID;
	public int mLegacyCoreBlockID;
	public int mRPMachine;
	public int mRPControl;
	public int mRPLighting;
	public int mRPLightingOn;
	public int mRPMagTubeMeta;
	public int mRPCounterMeta;
	public int mRPBlueLampMeta;
	public int mRPFlatBase;
	public int mRPIOExpanderMeta;
	
	public int mICMFSUID;
	public int mICMFSUMeta;
	
	public int mGRAdvancedHeatVent;
	public int mGRHellimuCollantCell;
	public int mICAdvancedCircuit;
	public int mICCable, mICGoldCableMeta;
	public int mICTeleport;
	
	public int mCCWirelessBase;
	public int mCCWirelessModemMeta;
	
	public BlockIdConfig(File configDir)
	{
		String newPath = configDir.getAbsolutePath() + configDir.separator + CONFIG_NAME;
		File configFile = new File(newPath);
		
		if(!configFile.exists())
		{
			try 
			{
				configFile.createNewFile();
			} catch (IOException e) 
			{
				throw new Error("Failed to create config file!");
			}
		}
		Configuration config = new Configuration(configFile);
		config.load();
		
		mMarkerBlockID = config.get(Configuration.CATEGORY_GENERAL, "markerBlock", 740).getInt();
		mLegacyCoreBlockID = config.get(Configuration.CATEGORY_GENERAL, "legacyCoreBlock", 741).getInt();
		
		mRPMachine = config.get(Configuration.CATEGORY_BLOCK, "RPMachine", 764).getInt();
		mRPMagTubeMeta = config.get(Configuration.CATEGORY_BLOCK, "RPMagTube", 2).getInt();
		
		mRPControl = config.get(Configuration.CATEGORY_BLOCK, "RPControl", 753).getInt();
		mRPCounterMeta = config.get(Configuration.CATEGORY_BLOCK, "RPCounter", 3).getInt();
		
		mRPLighting = config.get(Configuration.CATEGORY_BLOCK, "RPLighting", 757).getInt();
		mRPLightingOn = config.get(Configuration.CATEGORY_BLOCK, "RPLightingOn", 756).getInt();
		mRPBlueLampMeta = config.get(Configuration.CATEGORY_BLOCK, "RPBlueLamp", 11).getInt();
		
		mRPFlatBase = config.get(Configuration.CATEGORY_BLOCK, "RPFlatBase", 762).getInt();
		mRPIOExpanderMeta = config.get(Configuration.CATEGORY_BLOCK, "RPIOExpanderMeta", 0).getInt();
		
		mICMFSUID = config.get(Configuration.CATEGORY_BLOCK, "IC2MFSU", 4075).getInt();
		mICMFSUMeta = config.get(Configuration.CATEGORY_BLOCK, "IC2MFSUMeta", 2).getInt();
		
		mICAdvancedCircuit = config.get(Configuration.CATEGORY_BLOCK, "IC2AdvancedCircuit", 30190).getInt();
		mGRAdvancedHeatVent = config.get(Configuration.CATEGORY_BLOCK, "GRAdvancedHeatVent", 30089).getInt();
		mGRHellimuCollantCell = config.get(Configuration.CATEGORY_BLOCK, "GRHellimuCollantCell", 21292).getInt();
		mICCable = config.get(Configuration.CATEGORY_BLOCK, "ICCable", 30184).getInt();
		mICGoldCableMeta = config.get(Configuration.CATEGORY_BLOCK, "ICGoldCableMeta", 4).getInt();
		
		mCCWirelessBase = config.get(Configuration.CATEGORY_BLOCK, "CCWirelessBase", 1226).getInt();
		mCCWirelessModemMeta = config.get(Configuration.CATEGORY_BLOCK, "CCWirelessModemMeta", 1).getInt();
		mICTeleport = config.get(Configuration.CATEGORY_BLOCK, "ICTeleport", 618).getInt();
		
		config.save();
	}
}
