2013-11-16 16:21:37 +01:00
|
|
|
package universalelectricity.compatibility;
|
|
|
|
|
|
|
|
import universalelectricity.core.UniversalElectricity;
|
|
|
|
import universalelectricity.core.electricity.NetworkLoader;
|
|
|
|
import cpw.mods.fml.common.Loader;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Universal Electricity compatibility module allows your mod to be compatible with most major
|
|
|
|
* power systems in Minecraft.
|
|
|
|
*
|
|
|
|
* @author Calclavia, Micdoodle
|
|
|
|
*/
|
|
|
|
public class Compatibility
|
|
|
|
{
|
2013-12-01 07:41:01 +01:00
|
|
|
/** Version of BuildCraft api compiled with */
|
2013-11-16 16:21:37 +01:00
|
|
|
public static String BCx_VERSION = "@BCxVersion@";
|
2013-12-01 07:41:01 +01:00
|
|
|
/** Version of Industrial Craft api compiled with */
|
2013-11-16 16:21:37 +01:00
|
|
|
public static String ICx_VERSION = "@ICxVersion@";
|
2013-12-01 07:41:01 +01:00
|
|
|
/** Version of Thermal Expansion api compiled with */
|
2013-11-16 16:21:37 +01:00
|
|
|
public static String TEx_VERSION = "@TExVersion@";
|
|
|
|
|
|
|
|
/** Has the initiate method been called */
|
|
|
|
public static boolean INIT = false;
|
|
|
|
|
2013-12-01 07:41:01 +01:00
|
|
|
/** Ratio of Build craft(MJ) power to UE power(Kw). Multiply BC3 power by this to convert to UE */
|
2013-11-16 16:21:37 +01:00
|
|
|
public static float BC3_RATIO = 2.814f;
|
2013-12-01 07:41:01 +01:00
|
|
|
|
|
|
|
/** Ratio of Redstone Flux power to UE power(Kw). Multiply TE power by this to convert to UE */
|
|
|
|
public static float TE_RATIO = BC3_RATIO / 10;
|
|
|
|
|
2013-11-16 16:21:37 +01:00
|
|
|
/**
|
2013-12-01 07:41:01 +01:00
|
|
|
* Ratio of Industrial craft(EU) power to UE power(Kw). Multiply IC2 power by this to convert to
|
2013-11-16 16:21:37 +01:00
|
|
|
* UE
|
|
|
|
*/
|
|
|
|
public static float IC2_RATIO = 0.11256f;
|
|
|
|
|
2013-12-01 07:41:01 +01:00
|
|
|
/**
|
|
|
|
* Ratio of UE power(Kw) to Build craft(MJ) power. Multiply UE power by this to convert it to
|
|
|
|
* BC3 power
|
|
|
|
*/
|
|
|
|
public static float TO_BC_RATIO = 1 / BC3_RATIO;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ratio of UE power(Kw) to Redstone Flux power. Multiply UE power by this to convert it to TE
|
|
|
|
* power
|
|
|
|
*/
|
|
|
|
public static float TO_TE_RATIO = 1 / TE_RATIO;
|
|
|
|
|
2013-11-16 16:21:37 +01:00
|
|
|
/**
|
|
|
|
* Ratio of UE power(KW) to Industrial craft(EU) power. Multiply UE power by this to convert it
|
|
|
|
* to IC2 power
|
|
|
|
*/
|
|
|
|
public static float TO_IC2_RATIO = 1 / IC2_RATIO;
|
|
|
|
|
|
|
|
/** You must call this function to enable the Universal Network module. */
|
|
|
|
public static void initiate()
|
|
|
|
{
|
|
|
|
if (!INIT)
|
|
|
|
{
|
|
|
|
/** Outputs basic version information */
|
|
|
|
System.out.println("[UniversalElectricity] Loading compatibility API version " + UniversalElectricity.VERSION);
|
|
|
|
System.out.println("[UniversalElectricity] Compiled with IndustrialCraft API version " + Compatibility.ICx_VERSION);
|
|
|
|
System.out.println("[UniversalElectricity] Compiled with BuildCraft API version " + Compatibility.BCx_VERSION);
|
|
|
|
System.out.println("[UniversalElectricity] Compiled with ThermalExpansion API version " + Compatibility.TEx_VERSION);
|
|
|
|
|
|
|
|
/** Loads the configuration and sets all the values. */
|
|
|
|
UniversalElectricity.CONFIGURATION.load();
|
|
|
|
IC2_RATIO = (float) UniversalElectricity.CONFIGURATION.get("Compatiblity", "IndustrialCraft Conversion Ratio", IC2_RATIO).getDouble(IC2_RATIO);
|
2013-12-01 07:41:01 +01:00
|
|
|
TE_RATIO = (float) UniversalElectricity.CONFIGURATION.get("Compatiblity", "Thermal Expansion Conversion Ratio", TE_RATIO).getDouble(TE_RATIO);
|
2013-11-16 16:21:37 +01:00
|
|
|
BC3_RATIO = (float) UniversalElectricity.CONFIGURATION.get("Compatiblity", "BuildCraft Conversion Ratio", BC3_RATIO).getDouble(BC3_RATIO);
|
|
|
|
TO_IC2_RATIO = 1 / IC2_RATIO;
|
|
|
|
TO_BC_RATIO = 1 / BC3_RATIO;
|
|
|
|
UniversalElectricity.CONFIGURATION.save();
|
|
|
|
|
|
|
|
NetworkLoader.setNetworkClass(UniversalNetwork.class);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Checks using the FML loader too see if IC2 is loaded */
|
|
|
|
public static boolean isIndustrialCraft2Loaded()
|
|
|
|
{
|
|
|
|
return Loader.isModLoaded("IC2");
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Checks using the FML loader too see if BC3 is loaded */
|
|
|
|
public static boolean isBuildcraftLoaded()
|
|
|
|
{
|
|
|
|
return Loader.isModLoaded("BuildCraft|Energy");
|
|
|
|
}
|
|
|
|
|
2013-12-01 07:41:01 +01:00
|
|
|
public static boolean isThermalExpansionLoaded()
|
|
|
|
{
|
|
|
|
return Loader.isModLoaded("ThermalExpansion");
|
|
|
|
}
|
2013-11-16 16:21:37 +01:00
|
|
|
}
|