2014-07-07 21:31:10 +02:00
|
|
|
package com.pahimar.ee3.api;
|
|
|
|
|
|
|
|
import com.pahimar.ee3.EquivalentExchange3;
|
|
|
|
import cpw.mods.fml.common.Mod;
|
2014-07-14 20:39:23 +02:00
|
|
|
|
|
|
|
import java.util.List;
|
2014-07-07 21:31:10 +02:00
|
|
|
|
2014-07-14 12:51:35 +02:00
|
|
|
public final class EnergyValueRegistryProxy
|
2014-07-07 21:31:10 +02:00
|
|
|
{
|
|
|
|
@Mod.Instance("EE3")
|
|
|
|
private static Object ee3Mod;
|
|
|
|
|
2015-05-04 14:18:15 +02:00
|
|
|
public static void addPreAssignedEnergyValue(Object object, float energyValue)
|
2014-07-14 04:05:27 +02:00
|
|
|
{
|
2015-05-04 14:18:15 +02:00
|
|
|
addPreAssignedEnergyValue(object, new EnergyValue(energyValue));
|
2014-07-14 04:05:27 +02:00
|
|
|
}
|
|
|
|
|
2014-07-14 12:52:08 +02:00
|
|
|
public static void addPreAssignedEnergyValue(Object object, EnergyValue energyValue)
|
2014-07-07 21:31:10 +02:00
|
|
|
{
|
|
|
|
init();
|
|
|
|
|
2015-02-03 05:12:08 +01:00
|
|
|
if (ee3Mod != null)
|
2014-07-07 21:31:10 +02:00
|
|
|
{
|
2015-02-03 05:12:08 +01:00
|
|
|
EE3Wrapper.ee3mod.getEnergyValueRegistry().addPreAssignedEnergyValue(object, energyValue);
|
2014-07-07 21:31:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-04 14:18:15 +02:00
|
|
|
public static void addPostAssignedEnergyValue(Object object, float energyValue)
|
2014-07-14 04:05:27 +02:00
|
|
|
{
|
2015-05-04 14:18:15 +02:00
|
|
|
addPostAssignedEnergyValue(object, new EnergyValue(energyValue));
|
2014-07-14 04:05:27 +02:00
|
|
|
}
|
|
|
|
|
2014-07-14 12:52:08 +02:00
|
|
|
public static void addPostAssignedEnergyValue(Object object, EnergyValue energyValue)
|
2014-07-14 04:05:27 +02:00
|
|
|
{
|
|
|
|
init();
|
|
|
|
|
2015-02-03 05:12:08 +01:00
|
|
|
if (ee3Mod != null)
|
2014-07-07 21:31:10 +02:00
|
|
|
{
|
2015-03-05 05:31:43 +01:00
|
|
|
EE3Wrapper.ee3mod.getEnergyValueRegistry().addPostAssignedExactEnergyValue(object, energyValue);
|
2014-07-07 21:31:10 +02:00
|
|
|
}
|
2014-07-14 04:05:27 +02:00
|
|
|
}
|
|
|
|
|
2014-07-14 12:52:08 +02:00
|
|
|
public static boolean hasEnergyValue(Object object)
|
2014-07-14 04:05:27 +02:00
|
|
|
{
|
|
|
|
return hasEnergyValue(object, false);
|
2014-07-07 21:31:10 +02:00
|
|
|
}
|
|
|
|
|
2014-07-14 12:52:08 +02:00
|
|
|
public static boolean hasEnergyValue(Object object, boolean strict)
|
2014-07-07 21:31:10 +02:00
|
|
|
{
|
|
|
|
init();
|
|
|
|
|
2015-02-03 05:12:08 +01:00
|
|
|
if (ee3Mod != null)
|
2014-07-07 21:31:10 +02:00
|
|
|
{
|
2015-02-03 05:12:08 +01:00
|
|
|
return EE3Wrapper.ee3mod.getEnergyValueRegistry().hasEnergyValue(object, strict);
|
2014-07-07 21:31:10 +02:00
|
|
|
}
|
|
|
|
|
2015-02-03 05:12:08 +01:00
|
|
|
return false;
|
2014-07-14 04:05:27 +02:00
|
|
|
}
|
|
|
|
|
2014-07-14 12:52:08 +02:00
|
|
|
public static EnergyValue getEnergyValue(Object object)
|
2014-07-14 04:05:27 +02:00
|
|
|
{
|
|
|
|
return getEnergyValue(object, false);
|
2014-07-07 21:31:10 +02:00
|
|
|
}
|
|
|
|
|
2014-07-14 12:52:08 +02:00
|
|
|
public static EnergyValue getEnergyValue(Object object, boolean strict)
|
2014-07-07 21:31:10 +02:00
|
|
|
{
|
|
|
|
init();
|
|
|
|
|
2015-02-03 05:12:08 +01:00
|
|
|
if (ee3Mod != null)
|
2014-07-07 21:31:10 +02:00
|
|
|
{
|
2015-02-03 05:12:08 +01:00
|
|
|
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValue(object, strict);
|
2014-07-07 21:31:10 +02:00
|
|
|
}
|
|
|
|
|
2015-02-03 05:12:08 +01:00
|
|
|
return null;
|
2014-07-14 04:05:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-19 21:01:35 +02:00
|
|
|
public static EnergyValue getEnergyValueForStack(Object object)
|
|
|
|
{
|
|
|
|
return getEnergyValueForStack(object, false);
|
|
|
|
}
|
2015-02-20 04:09:10 +01:00
|
|
|
|
2015-04-19 21:01:35 +02:00
|
|
|
public static EnergyValue getEnergyValueForStack(Object object, boolean strict)
|
2014-07-14 20:39:23 +02:00
|
|
|
{
|
2015-04-19 21:01:35 +02:00
|
|
|
init();
|
|
|
|
|
|
|
|
if (ee3Mod != null)
|
|
|
|
{
|
|
|
|
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValueForStack(object, strict);
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
2014-07-14 20:39:23 +02:00
|
|
|
}
|
|
|
|
|
2015-05-04 14:18:15 +02:00
|
|
|
public static List getStacksInRange(float start, float finish)
|
2014-07-14 20:39:23 +02:00
|
|
|
{
|
2015-05-04 14:18:15 +02:00
|
|
|
return getStacksInRange(new EnergyValue(start), new EnergyValue(finish));
|
2014-07-14 20:39:23 +02:00
|
|
|
}
|
|
|
|
|
2014-07-25 04:03:36 +02:00
|
|
|
public static List getStacksInRange(EnergyValue start, EnergyValue finish)
|
2014-07-14 20:39:23 +02:00
|
|
|
{
|
2014-07-15 00:37:50 +02:00
|
|
|
init();
|
|
|
|
|
2015-02-03 05:12:08 +01:00
|
|
|
if (ee3Mod != null)
|
2014-07-15 00:37:50 +02:00
|
|
|
{
|
2015-02-03 05:12:08 +01:00
|
|
|
return EE3Wrapper.ee3mod.getEnergyValueRegistry().getStacksInRange(start, finish);
|
2014-07-15 00:37:50 +02:00
|
|
|
}
|
|
|
|
|
2015-02-03 05:12:08 +01:00
|
|
|
return null;
|
2014-07-14 20:39:23 +02:00
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-21 03:32:23 +02:00
|
|
|
private static class EE3Wrapper
|
|
|
|
{
|
|
|
|
private static EquivalentExchange3 ee3mod;
|
|
|
|
}
|
|
|
|
|
2014-07-14 04:05:27 +02:00
|
|
|
private static void init()
|
|
|
|
{
|
|
|
|
if (ee3Mod != null)
|
|
|
|
{
|
|
|
|
EE3Wrapper.ee3mod = (EquivalentExchange3) ee3Mod;
|
|
|
|
}
|
2014-07-07 21:31:10 +02:00
|
|
|
}
|
2015-04-09 18:40:19 +02:00
|
|
|
|
|
|
|
public enum Phase
|
|
|
|
{
|
|
|
|
PRE_ASSIGNMENT,
|
|
|
|
POST_ASSIGNMENT,
|
|
|
|
ALL
|
|
|
|
}
|
2014-07-07 21:31:10 +02:00
|
|
|
}
|