equivalent-exchange-3/src/main/java/com/pahimar/ee3/api/exchange/EnergyValueRegistryProxy.java

146 lines
3.4 KiB
Java
Raw Normal View History

2015-05-07 19:45:06 +02:00
package com.pahimar.ee3.api.exchange;
import com.pahimar.ee3.EquivalentExchange3;
import cpw.mods.fml.common.Mod;
import java.util.List;
2014-07-14 12:51:35 +02:00
public final class EnergyValueRegistryProxy
{
@Mod.Instance("EE3")
private static Object ee3Mod;
public static void addPreAssignedEnergyValue(Object object, float energyValue)
{
addPreAssignedEnergyValue(object, new EnergyValue(energyValue));
}
2014-07-14 12:52:08 +02:00
public static void addPreAssignedEnergyValue(Object object, EnergyValue energyValue)
{
init();
if (ee3Mod != null)
{
EE3Wrapper.ee3mod.getEnergyValueRegistry().addPreAssignedEnergyValue(object, energyValue);
}
}
public static void addPostAssignedEnergyValue(Object object, float energyValue)
{
addPostAssignedEnergyValue(object, new EnergyValue(energyValue));
}
2014-07-14 12:52:08 +02:00
public static void addPostAssignedEnergyValue(Object object, EnergyValue energyValue)
{
init();
if (ee3Mod != null)
{
EE3Wrapper.ee3mod.getEnergyValueRegistry().addPostAssignedExactEnergyValue(object, energyValue);
}
}
2014-07-14 12:52:08 +02:00
public static boolean hasEnergyValue(Object object)
{
return hasEnergyValue(object, false);
}
2014-07-14 12:52:08 +02:00
public static boolean hasEnergyValue(Object object, boolean strict)
{
init();
if (ee3Mod != null)
{
return EE3Wrapper.ee3mod.getEnergyValueRegistry().hasEnergyValue(object, strict);
}
return false;
}
2014-07-14 12:52:08 +02:00
public static EnergyValue getEnergyValue(Object object)
{
return getEnergyValue(object, false);
}
2014-07-14 12:52:08 +02:00
public static EnergyValue getEnergyValue(Object object, boolean strict)
{
init();
if (ee3Mod != null)
{
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValue(object, strict);
}
return null;
}
2015-04-19 21:01:35 +02:00
public static EnergyValue getEnergyValueForStack(Object object)
{
return getEnergyValueForStack(object, false);
}
2015-04-19 21:01:35 +02:00
public static EnergyValue getEnergyValueForStack(Object object, boolean strict)
{
2015-04-19 21:01:35 +02:00
init();
if (ee3Mod != null)
{
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValueForStack(object, strict);
}
return null;
}
public static List getStacksInRange(float start, float finish)
{
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
}
public static List getStacksInRange(EnergyValue start, EnergyValue finish)
{
init();
if (ee3Mod != null)
{
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getStacksInRange(start, finish);
}
return null;
}
2015-04-09 18:40:19 +02:00
public static void dumpEnergyValueRegistryToLog()
{
dumpEnergyValueRegistryToLog(Phase.ALL);
}
public static void dumpEnergyValueRegistryToLog(Phase phase)
{
init();
if (ee3Mod != null)
{
EE3Wrapper.ee3mod.getEnergyValueRegistry().dumpEnergyValueRegistryToLog(phase);
}
}
private static class EE3Wrapper
{
private static EquivalentExchange3 ee3mod;
}
private static void init()
{
if (ee3Mod != null)
{
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
}
}
2015-04-09 18:40:19 +02:00
public enum Phase
{
PRE_ASSIGNMENT,
POST_ASSIGNMENT,
ALL
}
}