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;
|
2013-07-27 00:16:21 +02:00
|
|
|
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;
|
2013-11-16 16:21:37 +01:00
|
|
|
|
|
|
|
//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.
|
|
|
|
*/
|
2013-07-27 00:16:21 +02:00
|
|
|
@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);
|
|
|
|
|
2013-07-27 00:16:21 +02:00
|
|
|
private static boolean INIT = false;
|
|
|
|
|
2013-04-13 16:35:13 +02:00
|
|
|
static
|
|
|
|
{
|
2013-07-27 00:16:21 +02:00
|
|
|
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
|
|
|
|
2013-07-27 00:16:21 +02:00
|
|
|
INIT = true;
|
2013-04-13 16:35:13 +02:00
|
|
|
}
|
|
|
|
}
|