Mekanism-tilera-Edition/common/universalelectricity/core/UniversalElectricity.java

87 lines
2.5 KiB
Java
Raw Normal View History

2013-04-13 16:35:13 +02:00
package universalelectricity.core;
import java.io.File;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
2013-04-13 16:35:13 +02:00
import cpw.mods.fml.common.Loader;
/**
* General Universal Electricity class.
*
* @author Calclavia
*
*/
public class UniversalElectricity
{
/**
* The version of the Universal Electricity API.
*/
public static final String MAJOR_VERSION = "@MAJOR@";
public static final String MINOR_VERSION = "@MINOR@";
public static final String REVISION_VERSION = "@REVIS@";
public static final String BUILD_VERSION = "@BUILD@";
public static final String VERSION = MAJOR_VERSION + "." + MINOR_VERSION + "." + REVISION_VERSION;
/**
* The Universal Electricity configuration file.
*/
public static final Configuration CONFIGURATION = new Configuration(new File(Loader.instance().getConfigDir(), "UniversalElectricity.cfg"));
/**
* Is Universal Electricity currently being voltage sensitive? If so, all machines should
* explode under high voltage and react to different amounts of voltage differently.
*/
public static boolean isVoltageSensitive = false;
//TODO: Enable this next major MC version
//public static float DEFAULT_VOLTAGE = 1;
2013-04-13 16:35:13 +02:00
/**
* Set this value to true if your mod contains and has the ability to transfer electricity via
* the ElectricityNetwork. Examples would be a mod that adds any sort of wire. This value will
* be true as long as there is a way to conduct electricity.
*/
@Deprecated
2013-04-13 16:35:13 +02:00
public static boolean isNetworkActive = false;
/**
* A general material that can be used by machines. Breakable by hand, suitable for machines.
*/
public static final Material machine = new Material(MapColor.ironColor);
private static boolean INIT = false;
2013-04-13 16:35:13 +02:00
static
{
initiate();
}
public static void initiate()
{
if (!INIT)
{
/**
* Loads the configuration and sets all the values.
*/
CONFIGURATION.load();
isVoltageSensitive = CONFIGURATION.get("Compatiblity", "Is Voltage Sensitive", isVoltageSensitive).getBoolean(isVoltageSensitive);
isNetworkActive = CONFIGURATION.get("Compatiblity", "Is Network Active", isNetworkActive).getBoolean(isNetworkActive);
CONFIGURATION.save();
try
{
MinecraftForge.EVENT_BUS.register(Class.forName("universalelectricity.core.electricity.ElectricityHelper").newInstance());
}
catch (Exception e)
{
e.printStackTrace();
}
}
2013-04-13 16:35:13 +02:00
INIT = true;
2013-04-13 16:35:13 +02:00
}
}