diff --git a/src/api/java/ic2/api/crops/Crops.class b/src/api/java/ic2/api/crops/Crops.class
index 8e10c6268..a97ba790f 100644
Binary files a/src/api/java/ic2/api/crops/Crops.class and b/src/api/java/ic2/api/crops/Crops.class differ
diff --git a/src/api/java/ic2/api/energy/IEnergyNet.class b/src/api/java/ic2/api/energy/IEnergyNet.class
index 1880b7d3e..7c4869363 100644
Binary files a/src/api/java/ic2/api/energy/IEnergyNet.class and b/src/api/java/ic2/api/energy/IEnergyNet.class differ
diff --git a/src/api/java/ic2/api/energy/IEnergyNet.java b/src/api/java/ic2/api/energy/IEnergyNet.java
index fc2dc58a0..4c79aa746 100644
--- a/src/api/java/ic2/api/energy/IEnergyNet.java
+++ b/src/api/java/ic2/api/energy/IEnergyNet.java
@@ -1,9 +1,13 @@
package ic2.api.energy;
+import java.io.PrintStream;
+
+import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import ic2.api.energy.tile.IEnergyTile;
+import ic2.api.info.ILocatable;
/**
* Interface representing the methods provided by the global EnergyNet class.
@@ -44,6 +48,11 @@ public interface IEnergyNet {
*/
IEnergyTile getSubTile(World world, BlockPos pos);
+ void addTile(T tile);
+ void addTile(T tile);
+
+ void removeTile(IEnergyTile tile);
+
World getWorld(IEnergyTile tile);
BlockPos getPos(IEnergyTile tile);
@@ -58,6 +67,8 @@ public interface IEnergyNet {
*/
NodeStats getNodeStats(IEnergyTile tile);
+ boolean dumpDebugInfo(World world, BlockPos pos, PrintStream console, PrintStream chat);
+
/**
* Determine the typical power used by the specific tier, e.g. 128 eu/t for tier 2.
*
@@ -73,4 +84,7 @@ public interface IEnergyNet {
* @return tier
*/
int getTierFromPower(double power);
+
+ void registerEventReceiver(IEnergyNetEventReceiver receiver);
+ void unregisterEventReceiver(IEnergyNetEventReceiver receiver);
}
diff --git a/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.class b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.class
new file mode 100644
index 000000000..c39d5b09a
Binary files /dev/null and b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.class differ
diff --git a/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.java b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.java
new file mode 100644
index 000000000..420eb10ff
--- /dev/null
+++ b/src/api/java/ic2/api/energy/IEnergyNetEventReceiver.java
@@ -0,0 +1,20 @@
+package ic2.api.energy;
+
+import ic2.api.energy.tile.IEnergyTile;
+
+/**
+ * Interface for handlers being invoked after energy net changes.
+ *
+ *
Normally it's enough to listen for the neighbor update, which also happens, but using this
+ * mechanism allows listening to events that are not adjacent. Mechanisms that inject energy over
+ * a distance or provide compatibility with 3rd party energy may benefit from it.
+ *
+ *
The events will be fired after validation and only for successful changes.
+ *
+ *
WARNING: The events may (and will) be invoked from arbitrary threads. It's up to the
+ * implementation of IEnergyNetEventReceiver to properly synchronize them.
+ */
+public interface IEnergyNetEventReceiver {
+ void onAdd(IEnergyTile tile);
+ void onRemove(IEnergyTile tile);
+}
diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Sink.class b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Sink.class
new file mode 100644
index 000000000..566fb3c53
Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Sink.class differ
diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Source.class b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Source.class
new file mode 100644
index 000000000..69a0e5df6
Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe$Source.class differ
diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.class b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.class
new file mode 100644
index 000000000..c94b587ce
Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.class differ
diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.java b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.java
new file mode 100644
index 000000000..6bd775a65
--- /dev/null
+++ b/src/api/java/ic2/api/energy/prefab/BasicEnergyTe.java
@@ -0,0 +1,104 @@
+package ic2.api.energy.prefab;
+
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * BasicEnergyTe.Sink and BasicEnergyTe.Source allow integrating tile entities into the energy net
+ * by using them as the super class.
+ *
+ *
They implement the necessary forwards to make BasicSink/BasicSource work, provided the sub
+ * classes always call those forwards when overriding them.
+ *
+ *
If it's not desirable to use BasicEnergyTe, the delegates like BasicSink can also be used
+ * directly, provided they receive the forwards like implemented here.
+ *
+ *
Example usage, machine with 10k EU buffer, tier 2, 50 EU/tick, 100 tick process time:
+ *
+ */
+public class BasicEnergyTe extends TileEntity {
+ public static class Sink extends BasicEnergyTe {
+ public Sink(int capacity, int tier) {
+ energyBuffer = new BasicSink(this, capacity, tier);
+ }
+ }
+
+ public static class Source extends BasicEnergyTe {
+ public Source(int capacity, int tier) {
+ energyBuffer = new BasicSource(this, capacity, tier);
+ }
+ }
+
+ protected BasicEnergyTe() { }
+
+ public T getEnergyBuffer() {
+ return energyBuffer;
+ }
+
+ // forwards >>
+
+ @Override
+ public void onLoad() {
+ energyBuffer.onLoad();
+ }
+
+ @Override
+ public void invalidate() {
+ super.invalidate();
+
+ energyBuffer.invalidate();
+ }
+
+ @Override
+ public void onChunkUnload() {
+ energyBuffer.onChunkUnload();
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+
+ energyBuffer.readFromNBT(nbt);
+ }
+
+ @Override
+ public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
+ return energyBuffer.writeToNBT(super.writeToNBT(nbt));
+ }
+
+ // << forwards
+
+ protected T energyBuffer;
+}
diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.class b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.class
new file mode 100644
index 000000000..66d017eef
Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.class differ
diff --git a/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.java b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.java
new file mode 100644
index 000000000..fc913bafe
--- /dev/null
+++ b/src/api/java/ic2/api/energy/prefab/BasicEnergyTile.java
@@ -0,0 +1,309 @@
+package ic2.api.energy.prefab;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+
+import net.minecraftforge.common.MinecraftForge;
+
+import ic2.api.energy.event.EnergyTileLoadEvent;
+import ic2.api.energy.event.EnergyTileUnloadEvent;
+import ic2.api.energy.tile.IEnergyTile;
+import ic2.api.info.ILocatable;
+import ic2.api.info.Info;
+import ic2.api.item.ElectricItem;
+
+/**
+ * Common functionality for BasicSink and BasicSource.
+ */
+abstract class BasicEnergyTile implements ILocatable, IEnergyTile {
+ // **********************************
+ // *** Methods for use by the mod ***
+ // **********************************
+
+ /**
+ * Constructor for a new BasicSink delegate.
+ *
+ * @param parent TileEntity represented by this energy sink.
+ * @param capacity Maximum amount of eu to store.
+ * @param tier IC2 tier, 1 = LV, 2 = MV, ...
+ */
+ protected BasicEnergyTile(TileEntity parent, double capacity) {
+ this((Object) parent, capacity);
+ }
+
+ protected BasicEnergyTile(ILocatable parent, double capacity) {
+ this((Object) parent, capacity);
+ }
+
+ private BasicEnergyTile(Object locationProvider, double capacity) {
+ this.locationProvider = locationProvider;
+ this.capacity = capacity;
+ }
+
+ protected BasicEnergyTile(World world, BlockPos pos, double capacity) {
+ if (world == null) throw new NullPointerException("null world");
+ if (pos == null) throw new NullPointerException("null pos");
+
+ this.locationProvider = null;
+ this.world = world;
+ this.pos = pos;
+ this.capacity = capacity;
+ }
+
+ // in-world te forwards >>
+
+ /**
+ * Forward for the base TileEntity's update(), used for creating the energy net link.
+ * Either update or onLoad have to be used.
+ */
+ public void update() {
+ if (!addedToEnet) onLoad();
+ }
+
+ /**
+ * Notification that the base TileEntity is loaded, used for creating the energy net link.
+ * Either update or onLoad have to be used.
+ */
+ public void onLoad() {
+ if (!addedToEnet
+ && !getWorldObj().isRemote
+ && Info.isIc2Available()) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
+
+ addedToEnet = true;
+ }
+ }
+
+ /**
+ * Forward for the base TileEntity's invalidate(), used for destroying the energy net link.
+ * Both invalidate and onChunkUnload have to be used.
+ */
+ public void invalidate() {
+ onChunkUnload();
+ }
+
+ /**
+ * Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link.
+ * Both invalidate and onChunkUnload have to be used.
+ */
+ public void onChunkUnload() {
+ if (addedToEnet
+ && !getWorldObj().isRemote
+ && Info.isIc2Available()) {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+
+ addedToEnet = false;
+ }
+ }
+
+ /**
+ * Forward for the base TileEntity's readFromNBT(), used for loading the state.
+ *
+ * @param tag Compound tag as supplied by TileEntity.readFromNBT()
+ */
+ public void readFromNBT(NBTTagCompound tag) {
+ NBTTagCompound data = tag.getCompoundTag(getNbtTagName());
+ energyStored = data.getDouble("energy");
+ }
+
+ /**
+ * Forward for the base TileEntity's writeToNBT(), used for saving the state.
+ *
+ * @param tag Compound tag as supplied by TileEntity.writeToNBT()
+ */
+ public NBTTagCompound writeToNBT(NBTTagCompound tag) {
+ NBTTagCompound data = new NBTTagCompound();
+
+ data.setDouble("energy", energyStored);
+ tag.setTag(getNbtTagName(), data);
+
+ return tag;
+ }
+
+ // << in-world te forwards
+ // methods for using this adapter >>
+
+ /**
+ * Get the maximum amount of energy this sink can hold in its buffer.
+ *
+ * @return Capacity in EU.
+ */
+ public double getCapacity() {
+ return capacity;
+ }
+
+ /**
+ * Set the maximum amount of energy this sink can hold in its buffer.
+ *
+ * @param capacity1 Capacity in EU.
+ */
+ public void setCapacity(double capacity) {
+ this.capacity = capacity;
+ }
+
+ /**
+ * Determine the energy stored in this buffer.
+ *
+ * @return amount in EU, may be above capacity
+ */
+ public double getEnergyStored() {
+ return energyStored;
+ }
+
+ /**
+ * Set the stored energy to the specified amount.
+ *
+ * This is intended for server -> client synchronization, e.g. to display the stored energy in
+ * a GUI through getEnergyStored().
+ *
+ * @param amount
+ */
+ public void setEnergyStored(double amount) {
+ energyStored = amount;
+ }
+
+ /**
+ * Determine the free capacity in this buffer.
+ *
+ * @return amount in EU
+ */
+ public double getFreeCapacity() {
+ return capacity - energyStored;
+ }
+
+ /**
+ * Add some energy to the output buffer.
+ *
+ * @param amount maximum amount of energy to add
+ * @return amount added/used, NOT remaining
+ */
+ public double addEnergy(double amount) {
+ if (getWorldObj().isRemote) return 0;
+ if (amount > capacity - energyStored) amount = capacity - energyStored;
+
+ energyStored += amount;
+
+ return amount;
+ }
+
+ /**
+ * Determine if the specified amount of energy is available.
+ *
+ * @param amount in EU
+ * @return true if the amount is available
+ */
+ public boolean canUseEnergy(double amount) {
+ return energyStored >= amount;
+ }
+
+ /**
+ * Use the specified amount of energy, if available.
+ *
+ * @param amount amount to use
+ * @return true if the amount was available
+ */
+ public boolean useEnergy(double amount) {
+ if (!canUseEnergy(amount) || getWorldObj().isRemote) return false;
+
+ energyStored -= amount;
+
+ return true;
+ }
+
+ /**
+ * Charge the supplied ItemStack from this energy buffer.
+ *
+ * @param stack ItemStack to charge (null is ignored)
+ * @return true if energy was transferred
+ */
+ public boolean charge(ItemStack stack) {
+ if (stack == null || !Info.isIc2Available() || getWorldObj().isRemote) return false;
+
+ double amount = ElectricItem.manager.charge(stack, energyStored, Math.max(getSinkTier(), getSourceTier()), false, false);
+
+ energyStored -= amount;
+
+ return amount > 0;
+ }
+
+ /**
+ * Discharge the supplied ItemStack into this energy buffer.
+ *
+ * @param stack ItemStack to discharge (null is ignored)
+ * @param limit Transfer limit, values <= 0 will use the battery's limit
+ * @return true if energy was transferred
+ */
+ public boolean discharge(ItemStack stack, double limit) {
+ if (stack == null || !Info.isIc2Available() || getWorldObj().isRemote) return false;
+
+ double amount = capacity - energyStored;
+ if (amount <= 0) return false;
+
+ if (limit > 0 && limit < amount) amount = limit;
+
+ amount = ElectricItem.manager.discharge(stack, amount, Math.max(getSinkTier(), getSourceTier()), limit > 0, true, false);
+
+ energyStored += amount;
+
+ return amount > 0;
+ }
+
+ // << methods for using this adapter
+
+ // ******************************
+ // *** Methods for use by ic2 ***
+ // ******************************
+
+ // ILocatable >>
+
+ @Override
+ public World getWorldObj() {
+ if (world == null) initLocation();
+
+ return world;
+ }
+
+ @Override
+ public BlockPos getPosition() {
+ if (pos == null) initLocation();
+
+ return pos;
+ }
+
+ private void initLocation() {
+ if (locationProvider instanceof ILocatable) {
+ ILocatable provider = (ILocatable) locationProvider;
+ world = provider.getWorldObj();
+ pos = provider.getPosition();
+ } else if (locationProvider instanceof TileEntity) {
+ TileEntity provider = (TileEntity) locationProvider;
+ world = provider.getWorld();
+ pos = provider.getPos();
+ } else {
+ throw new IllegalStateException("no/incompatible location provider");
+ }
+ }
+
+ // << ILocatable
+
+ protected abstract String getNbtTagName();
+
+ protected int getSinkTier() {
+ return 0;
+ }
+
+ protected int getSourceTier() {
+ return 0;
+ }
+
+ private final Object locationProvider;
+ protected World world;
+ protected BlockPos pos;
+
+ protected double capacity;
+ protected double energyStored;
+ protected boolean addedToEnet;
+}
diff --git a/src/api/java/ic2/api/energy/prefab/BasicSink.class b/src/api/java/ic2/api/energy/prefab/BasicSink.class
new file mode 100644
index 000000000..32434a7ee
Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicSink.class differ
diff --git a/src/api/java/ic2/api/energy/prefab/BasicSink.java b/src/api/java/ic2/api/energy/prefab/BasicSink.java
new file mode 100644
index 000000000..1e1614058
--- /dev/null
+++ b/src/api/java/ic2/api/energy/prefab/BasicSink.java
@@ -0,0 +1,155 @@
+package ic2.api.energy.prefab;
+
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+
+import ic2.api.energy.tile.IEnergyEmitter;
+import ic2.api.energy.tile.IEnergySink;
+import ic2.api.info.ILocatable;
+
+/**
+ * BasicSink is a simple delegate to provide an ic2 energy sink.
+ *
+ *
It's designed to be attached to a tile entity as a delegate. Functionally BasicSink acts as a
+ * one-time configurable input energy buffer, thus providing a common use case for machines.
+ *
+ *
A simpler alternative is to use {@link BasicSinkTe.Sink}, which requires injecting into the
+ * type hierarchy (using it as a super class). BasicSink however can be added to any class without
+ * inheritance, but needs some forwards for keeping its state and registering with the energy net.
+ *
+ *
The constraints set by BasicSink like the strict tank-like energy buffering should provide a
+ * more easy to use and stable interface than using IEnergySink directly while aiming for
+ * optimal performance.
+ *
+ *
Using BasicSink involves the following steps:
+ *
create a BasicSink instance in your TileEntity, typically in a field
+ *
forward onLoad (or update), invalidate, onChunkUnload, readFromNBT and writeToNBT to the BasicSink
+ * instance.
+ *
call useEnergy whenever appropriate. canUseEnergy determines if enough energy is available
+ * without consuming the energy.
+ *
optionally use getEnergyStored to display the output buffer charge level
+ *
optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container)
+ *
+ *
Example implementation code:
+ *
+ * public class SomeTileEntity extends TileEntity {
+ * // new basic energy sink, 1000 EU buffer, tier 1 (32 EU/t, LV)
+ * private BasicSink ic2EnergySink = new BasicSink(this, 1000, 1);
+ *
+ * {@literal @}Override
+ * public void onLoad() {
+ * ic2EnergySink.onLoad(); // notify the energy sink
+ * ...
+ * }
+ *
+ * {@literal @}Override
+ * public void invalidate() {
+ * ic2EnergySink.invalidate(); // notify the energy sink
+ * ...
+ * super.invalidate(); // this is important for mc!
+ * }
+ *
+ * {@literal @}Override
+ * public void onChunkUnload() {
+ * ic2EnergySink.onChunkUnload(); // notify the energy sink
+ * ...
+ * }
+ *
+ * {@literal @}Override
+ * public void readFromNBT(NBTTagCompound tag) {
+ * super.readFromNBT(tag);
+ *
+ * ic2EnergySink.readFromNBT(tag);
+ * ...
+ * }
+ *
+ * {@literal @}Override
+ * public void writeToNBT(NBTTagCompound tag) {
+ * super.writeToNBT(tag);
+ *
+ * ic2EnergySink.writeToNBT(tag);
+ * ...
+ * }
+ *
+ * {@literal @}Override
+ * public void update() {
+ * if (ic2EnergySink.useEnergy(5)) { // use 5 eu from the sink's buffer this tick
+ * ... // do something with the energy
+ * }
+ * ...
+ * }
+ *
+ * ...
+ * }
+ *
+ */
+public class BasicSink extends BasicEnergyTile implements IEnergySink {
+ /**
+ * Constructor for a new BasicSink delegate.
+ *
+ * @param parent TileEntity represented by this energy sink.
+ * @param capacity Maximum amount of eu to store.
+ * @param tier IC2 tier, 1 = LV, 2 = MV, ...
+ */
+ public BasicSink(TileEntity parent, double capacity, int tier) {
+ super(parent, capacity);
+
+ this.tier = tier;
+ }
+
+ public BasicSink(ILocatable parent, double capacity, int tier) {
+ super(parent, capacity);
+
+ this.tier = tier;
+ }
+
+ public BasicSink(World world, BlockPos pos, double capacity, int tier) {
+ super(world, pos, capacity);
+
+ this.tier = tier;
+ }
+
+ /**
+ * Set the IC2 energy tier for this sink.
+ *
+ * @param tier IC2 Tier.
+ */
+ public void setSinkTier(int tier) {
+ this.tier = tier;
+ }
+
+ // energy net interface >>
+
+ @Override
+ public boolean acceptsEnergyFrom(IEnergyEmitter emitter, EnumFacing direction) {
+ return true;
+ }
+
+ @Override
+ public double getDemandedEnergy() {
+ return Math.max(0, capacity - energyStored);
+ }
+
+ @Override
+ public double injectEnergy(EnumFacing directionFrom, double amount, double voltage) {
+ energyStored += amount;
+
+ return 0;
+ }
+
+ @Override
+ public int getSinkTier() {
+ return tier;
+ }
+
+ // << energy net interface
+
+ @Override
+ protected String getNbtTagName() {
+ return "IC2BasicSink";
+ }
+
+ protected int tier;
+}
diff --git a/src/api/java/ic2/api/energy/prefab/BasicSinkSource.class b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.class
new file mode 100644
index 000000000..ca5b57625
Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.class differ
diff --git a/src/api/java/ic2/api/energy/prefab/BasicSinkSource.java b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.java
new file mode 100644
index 000000000..f9f936f6c
--- /dev/null
+++ b/src/api/java/ic2/api/energy/prefab/BasicSinkSource.java
@@ -0,0 +1,116 @@
+package ic2.api.energy.prefab;
+
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+
+import ic2.api.energy.EnergyNet;
+import ic2.api.energy.tile.IEnergySink;
+import ic2.api.energy.tile.IEnergySource;
+import ic2.api.info.ILocatable;
+
+/**
+ * Combination of BasicSink and BasicSource, see their respective documentation for details.
+ *
+ *
A subclass still has to implement acceptsEnergyFrom and emitsEnergyTo.
+ */
+public abstract class BasicSinkSource extends BasicEnergyTile implements IEnergySink, IEnergySource {
+ public BasicSinkSource(TileEntity parent, double capacity, int sinkTier, int sourceTier) {
+ super(parent, capacity);
+
+ this.sinkTier = sinkTier;
+ this.sourceTier = sourceTier;
+ this.sourcePower = EnergyNet.instance.getPowerFromTier(sourceTier);
+
+ if (getCapacity() < sourcePower) setCapacity(sourcePower);
+ }
+
+ public BasicSinkSource(ILocatable parent, double capacity, int sinkTier, int sourceTier) {
+ super(parent, capacity);
+
+ this.sinkTier = sinkTier;
+ this.sourceTier = sourceTier;
+ this.sourcePower = EnergyNet.instance.getPowerFromTier(sourceTier);
+
+ if (getCapacity() < sourcePower) setCapacity(sourcePower);
+ }
+
+ public BasicSinkSource(World world, BlockPos pos, double capacity, int sinkTier, int sourceTier) {
+ super(world, pos, capacity);
+
+ this.sinkTier = sinkTier;
+ this.sourceTier = sourceTier;
+ this.sourcePower = EnergyNet.instance.getPowerFromTier(sourceTier);
+
+ if (getCapacity() < sourcePower) setCapacity(sourcePower);
+ }
+
+ /**
+ * Set the IC2 energy tier for this sink.
+ *
+ * @param tier IC2 Tier.
+ */
+ public void setSinkTier(int tier) {
+ this.sinkTier = tier;
+ }
+
+ /**
+ * Set the IC2 energy tier for this source.
+ *
+ * @param tier IC2 Tier.
+ */
+ public void setSourceTier(int tier) {
+ double power = EnergyNet.instance.getPowerFromTier(tier);
+
+ if (getCapacity() < power) setCapacity(power);
+
+ this.sourceTier = tier;
+ this.sourcePower = power;
+ }
+
+ // energy net interface >>
+
+ @Override
+ public double getDemandedEnergy() {
+ return Math.max(0, capacity - energyStored);
+ }
+
+ @Override
+ public double injectEnergy(EnumFacing directionFrom, double amount, double voltage) {
+ energyStored += amount;
+
+ return 0;
+ }
+
+ @Override
+ public int getSinkTier() {
+ return sinkTier;
+ }
+
+ @Override
+ public double getOfferedEnergy() {
+ return Math.min(energyStored, sourcePower);
+ }
+
+ @Override
+ public void drawEnergy(double amount) {
+ energyStored -= amount;
+ }
+
+ @Override
+ public int getSourceTier() {
+ return sourceTier;
+ }
+
+ // << energy net interface
+
+ @Override
+ protected String getNbtTagName() {
+ return "IC2BasicSinkSource";
+ }
+
+ protected int sinkTier;
+ protected int sourceTier;
+ protected double sourcePower;
+}
diff --git a/src/api/java/ic2/api/energy/prefab/BasicSource.class b/src/api/java/ic2/api/energy/prefab/BasicSource.class
new file mode 100644
index 000000000..aa2381717
Binary files /dev/null and b/src/api/java/ic2/api/energy/prefab/BasicSource.class differ
diff --git a/src/api/java/ic2/api/energy/prefab/BasicSource.java b/src/api/java/ic2/api/energy/prefab/BasicSource.java
new file mode 100644
index 000000000..41ca69209
--- /dev/null
+++ b/src/api/java/ic2/api/energy/prefab/BasicSource.java
@@ -0,0 +1,167 @@
+package ic2.api.energy.prefab;
+
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.EnumFacing;
+import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.World;
+
+import ic2.api.energy.EnergyNet;
+import ic2.api.energy.tile.IEnergyAcceptor;
+import ic2.api.energy.tile.IEnergySource;
+import ic2.api.info.ILocatable;
+
+/**
+ * BasicSource is a simple delegate to add an ic2 energy source.
+ *
+ *
It's designed to be attached to a tile entity as a delegate. Functionally BasicSource acts as a
+ * one-time configurable output energy buffer, thus providing a common use case for generators.
+ *
+ *
A simpler alternative is to use {@link BasicSinkTe.Source}, which requires injecting into the
+ * type hierarchy (using it as a super class). BasicSource however can be added to any class without
+ * inheritance, but needs some forwards for keeping its state and registering with the energy net.
+ *
+ *
The constraints set by BasicSource like the strict tank-like energy buffering should provide a
+ * more easy to use and stable interface than using IEnergySource directly while aiming for
+ * optimal performance.
+ *
+ *
Using BasicSource involves the following steps:
+ *
create a BasicSource instance in your TileEntity, typically in a field
+ *
forward onLoad (or update), invalidate, onChunkUnload, readFromNBT ans writeToNBT to the BasicSource
+ * instance.
+ *
call addEnergy whenever appropriate, using getFreeCapacity may determine if e.g. the generator
+ * should run
+ *
optionally use getEnergyStored to display the output buffer charge level
+ *
optionally use setEnergyStored to sync the stored energy to the client (e.g. in the Container)
+ *
+ *
Example implementation code:
+ *
+ * public class SomeTileEntity extends TileEntity {
+ * // new basic energy source, 1000 EU buffer, tier 1 (32 EU/t, LV)
+ * private BasicSource ic2EnergySource = new BasicSource(this, 1000, 1);
+ *
+ * {@literal @}Override
+ * public void onLoad() {
+ * ic2EnergySource.onLoad(); // notify the energy source
+ * ...
+ * }
+ *
+ * {@literal @}Override
+ * public void invalidate() {
+ * ic2EnergySource.invalidate(); // notify the energy source
+ * ...
+ * super.invalidate(); // this is important for mc!
+ * }
+ *
+ * {@literal @}Override
+ * public void onChunkUnload() {
+ * ic2EnergySource.onChunkUnload(); // notify the energy source
+ * ...
+ * }
+ *
+ * {@literal @}Override
+ * public void readFromNBT(NBTTagCompound tag) {
+ * super.readFromNBT(tag);
+ *
+ * ic2EnergySource.readFromNBT(tag);
+ * ...
+ * }
+ *
+ * {@literal @}Override
+ * public void writeToNBT(NBTTagCompound tag) {
+ * super.writeToNBT(tag);
+ *
+ * ic2EnergySource.writeToNBT(tag);
+ * ...
+ * }
+ *
+ * {@literal @}Override
+ * public void update() {
+ * ic2EnergySource.addEnergy(5); // add 5 eu to the source's buffer this tick
+ * ...
+ * }
+ *
+ * ...
+ * }
+ *
+ */
+public class BasicSource extends BasicEnergyTile implements IEnergySource {
+ /**
+ * Constructor for a new BasicSource delegate.
+ *
+ * @param parent1 Base TileEntity represented by this energy source.
+ * @param capacity1 Maximum amount of eu to store.
+ * @param tier1 IC2 tier, 1 = LV, 2 = MV, ...
+ */
+ public BasicSource(TileEntity parent, double capacity, int tier) {
+ super(parent, capacity);
+
+ this.tier = tier;
+ this.power = EnergyNet.instance.getPowerFromTier(tier);
+
+ if (getCapacity() < power) setCapacity(power);
+ }
+
+ public BasicSource(ILocatable parent, double capacity, int tier) {
+ super(parent, capacity);
+
+ this.tier = tier;
+ this.power = EnergyNet.instance.getPowerFromTier(tier);
+
+ if (getCapacity() < power) setCapacity(power);
+ }
+
+ public BasicSource(World world, BlockPos pos, double capacity, int tier) {
+ super(world, pos, capacity);
+
+ this.tier = tier;
+ this.power = EnergyNet.instance.getPowerFromTier(tier);
+
+ if (getCapacity() < power) setCapacity(power);
+ }
+
+ /**
+ * Set the IC2 energy tier for this source.
+ *
+ * @param tier1 IC2 Tier.
+ */
+ public void setSourceTier(int tier) {
+ double power = EnergyNet.instance.getPowerFromTier(tier);
+
+ if (getCapacity() < power) setCapacity(power);
+
+ this.tier = tier;
+ this.power = power;
+ }
+
+ // energy net interface >>
+
+ @Override
+ public boolean emitsEnergyTo(IEnergyAcceptor receiver, EnumFacing direction) {
+ return true;
+ }
+
+ @Override
+ public double getOfferedEnergy() {
+ return Math.min(energyStored, power);
+ }
+
+ @Override
+ public void drawEnergy(double amount) {
+ energyStored -= amount;
+ }
+
+ @Override
+ public int getSourceTier() {
+ return tier;
+ }
+
+ // << energy net interface
+
+ @Override
+ protected String getNbtTagName() {
+ return "IC2BasicSource";
+ }
+
+ protected int tier;
+ protected double power;
+}
diff --git a/src/api/java/ic2/api/info/ITeBlock.java b/src/api/java/ic2/api/info/ITeBlock.java
index fe44aa734..7fc6665a4 100644
--- a/src/api/java/ic2/api/info/ITeBlock.java
+++ b/src/api/java/ic2/api/info/ITeBlock.java
@@ -1,8 +1,7 @@
package ic2.api.info;
-import java.util.Set;
-
import net.minecraft.block.material.Material;
+import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
@@ -19,25 +18,14 @@ import ic2.api.tile.IWrenchable;
* by being able to extend it means all those methods you can now extend and be confident they will be called correctly.
*
*
- * The more observant might have noticed there was an event that allowed you to do basically the same thing called TeBlockBakeEvent.
- * Whilst that event used to add your own class onto TeBlock (that wasn't ideal as you could end up using the same ID as another addon which would cause a crash),
- * this allows you to completely implement your own version of TeBlock, then let IC2 take it and build the necessary structures around it.
- * Both mean you no longer have to use EnumHelper and lots of reflection to mess about with TeBlock,
- * just to be left with either a crash from doing it too late/wrong, or lots of code bound to IC2 (such as language keys and blockstate jsons being in IC2's assets).
- *
- *
- * Unlike TeBlockBakeEvent, this gives you near total control of your tile entities:
+ * Because it allows effectively level control to IC2 itself, this gives you near total control of your tile entities:
*
* You can pick whether each of your tile entity items show up in creative, and the order in which they do.
- * You can choose whether you use an enum or class for your implementation.
- * We use (and I personally recommend) using an enum, as the values should never change, but in the end the choice is yours.
* There is a proper separation between each registered ITeBlock by resource location, rather than everything being inserted into a single enum.
* You also receive your own instance of BlockTileEntity and ItemBlockTileEntity rather than having to use IC2's own one.
* All the language keys and blockstate file are in your own assets (which you can, and in fact have to, pick).
+ * You can have custom item models with non-standard model locations.
*
- * It is a vast improvement over TeBlockBakeEvent, which is probably important as it's gone now ;)
- *
- *
* The event allows you to properly register your own version of TeBlock in a way that will be as fully supported as is physically possible.
* It's not in the actual API itself as it's heavily dependent on internal classes, so you have this instead.
* This is also probably the most documented thing in the entire IC2 API. I'm too kind really. ;)
@@ -49,44 +37,42 @@ import ic2.api.tile.IWrenchable;
*import net.minecraftforge.common.MinecraftForge;
*import net.minecraftforge.fml.common.Mod;
*import net.minecraftforge.fml.common.Mod.EventHandler;
- *import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
+ *import net.minecraftforge.fml.common.event.FMLConstructionEvent;
*import net.minecraftforge.fml.common.event.FMLInitializationEvent;
- *
- *{@literal @}Mod(modId="ExampleIC2Addon")
- *public class ExampleIC2Addon {
- * public ExampleIC2Addon() {
- * //You have to register before IC2 reaches Pre-Initialization, which unless you specifically load before it is unlikely you'll achieve.
- * //Especially if you're an addon, you'll want to be loading after IC2 not before!
- * //But, your mod's constructor will definitely be called before then. The issue is it's called more than once.
- * //If you try registering the same tile entity ID twice it will crash (more on that later), so you'll have to use a singleton instance.
- * //An enum works well for this, but anything will work as long as it's registered to the event bus once, and only once.
- * MinecraftForge.EVENT_BUS.register(TileEntityRegisterer.INSTANCE);
- * }
- *
- * {@literal @}EventHandler
- * public void preInit(FMLPreInitializationEvent event) {
- * MyTeBlock.registerTileEntities();
- * }
- *
- * {@literal @}EventHandler
- * public void preInit(FMLInitializationEvent event) {
- * MyTeBlock.buildDummies();
- * }
- *}
+ *import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
*
*import ic2.api.event.TeBlockFinalCallEvent;
*import ic2.core.block.TeBlockRegistry;
- *import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
*
- *public enum TileEntityRegisterer {
- * INSTANCE;
+ *{@literal @}Mod(modId="ExampleIC2Addon")
+ *public class ExampleIC2Addon {
+ * {@literal @}EventHandler
+ * public void start(FMLConstructionEvent event) {
+ * MinecraftForge.EVENT_BUS.register(this);
+ * }
*
* {@literal @}SubscribeEvent
* public void register(TeBlockFinalCallEvent event) {
* TeBlockRegistry.addAll(MyTeBlock.class, MyTeBlock.IDENTITY);
+ *
+ * MinecraftForge.EVENT_BUS.unregister(this);
+ * }
+ *
+ * {@literal @}EventHandler
+ * public void init(FMLInitializationEvent event) {
+ * MyTeBlock.buildDummies();
* }
*}
*
+ *
+ *import net.minecraft.block.material.Material;
+ *import net.minecraft.creativetab.CreativeTabs;
+ *import net.minecraft.item.EnumRarity;
+ *import net.minecraft.item.ItemStack;
+ *import net.minecraft.tileentity.TileEntity;
+ *import net.minecraft.util.EnumFacing;
+ *import net.minecraft.util.ResourceLocation;
+ *
*import ic2.core.block.BlockTileEntity;
*import ic2.core.block.ITeBlock;
*import ic2.core.block.TileEntityBlock;
@@ -95,21 +81,14 @@ import ic2.api.tile.IWrenchable;
*import ic2.core.ref.TeBlock.HarvestTool;
*import ic2.core.ref.TeBlock.ITePlaceHandler;
*import ic2.core.util.Util;
- *import net.minecraft.block.material.Material;
- *import net.minecraft.creativetab.CreativeTabs;
- *import net.minecraft.item.EnumRarity;
- *import net.minecraft.item.ItemStack;
- *import net.minecraft.tileentity.TileEntity;
- *import net.minecraft.util.EnumFacing;
- *import net.minecraft.util.ResourceLocation;
*
*public enum MyTeBlock implements ITeBlock {
- * my_machine_name(MyMachineTileEntity.class, 0, false, Util.noFacings, false, HarvestTool.Pickaxe, DefaultDrop.Machine, 5, 10, EnumRarity.UNCOMMON, Material.IRON);
+ * my_machine_name(MyMachineTileEntity.class, 0, false, Util.noFacings, false, HarvestTool.Pickaxe, DefaultDrop.Machine, 5, 10, EnumRarity.UNCOMMON, Material.IRON, false);
*
* private MyTeBlock(Class extends TileEntityBlock> teClass, int ID,
* boolean hasActive, Set{@literal <}EnumFacing{@literal >} possibleFacings, boolean canBeWrenched,
* HarvestTool tool, DefaultDrop drop,
- * float hardness, float explosionResistance, EnumRarity rarity, Material material) {
+ * float hardness, float explosionResistance, EnumRarity rarity, Material material, boolean isTransparent) {
* this.teClass = teClass;
* this.ID = ID;
* this.hasActive = hasActive;
@@ -121,6 +100,9 @@ import ic2.api.tile.IWrenchable;
* this.explosionResistance = explosionResistance;
* this.rarity = rarity;
* this.material = material;
+ * this.isTransparent = isTransparent;
+ *
+ * TileEntity.addMapping(block.teClass, IDENTITY.getResourceDomain() + ':' + block.getName());
* }
*
* {@literal @}Override
@@ -194,12 +176,8 @@ import ic2.api.tile.IWrenchable;
* }
*
* {@literal @}Override
- * public void addSubBlocks(List{@literal <}ItemStack{@literal >} list, BlockTileEntity block, ItemBlockTileEntity item, CreativeTabs tab) {
- * for (MyTeBlock block : values()) {
- * if (type.hasItem()) {
- * list.add(block.getItemStack(type));
- * }
- * }
+ * public boolean isTransparent() {
+ * return isTransparent;
* }
*
* {@literal @}Override
@@ -212,15 +190,9 @@ import ic2.api.tile.IWrenchable;
* return placeHandler;
* }
*
- * public static void registerTileEntities() {
- * for (MyTeBlock block : values()) {
- * if (block.teClass != null) TileEntity.addMapping(block.teClass, IDENTITY.getResourceDomain() + ':' + block.getName());
- * }
- * }
- *
* public static void buildDummies() {
* for (MyTeBlock block : values()) {
- * //System.out.printf("Registering %s (with teClass %s)%n", block.getName(), block.teClass);
+ * //System.out.printf("Building %s (with teClass %s)%n", block.getName(), block.teClass);
* if (block.teClass != null) {
* try {
* block.dummyTe = block.teClass.newInstance();
@@ -247,6 +219,7 @@ import ic2.api.tile.IWrenchable;
* private final float explosionResistance;
* private final EnumRarity rarity;
* private final Material material;
+ * private final boolean isTransparent;
* private TileEntityBlock dummyTe;
* private ITePlaceHandler placeHandler;
*
@@ -275,7 +248,7 @@ import ic2.api.tile.IWrenchable;
*
itemMeta: The ID of the new instance. This is utterly critical, as it's the thing used to detect which ITeBlock an item is.
* That's very important as the tile entity class is worked out by the ID when a block's being placed in ItemBlockTileEntity.
* Changing this will cause everyone's items to change and there is no stopping that if you do.
- * The ID you pick should start at 0, and go up to Short.MAX_VALUE.
+ * The ID you pick should start at 0, and go up to {@link Short#MAX_VALUE}.
* Use -1 if the tile entity doesn't have an item form (or is placed using an item other than ItemBlockTileEntity).
*
identifier: The resource location associated with the ITeBlock.
* The language keys, translations and internal mappings all use this, so it's best to store it as a static final variable and use that.
@@ -291,16 +264,13 @@ import ic2.api.tile.IWrenchable;
*
hardness: The hardness the block should have with the tile entity, IC2 normally uses 5.
*
explosionResistance: The explosionResistance the block should have with the tile entity, IC2 normally uses 10.
*
rarity: The EnumRarity that the item will have for the tile entity.
- *
material: The {@link Material} that the block representing the tile entity should have. Maximum of 16 different ones per ITeBlock registration.
+ *
material: The {@link Material} that the block representing the tile entity should have. Maximum of 8 different ones per ITeBlock registration.
+ *
isTransparent: Whether the block should be rendered with {@link BlockRenderLayer#CUTOUT} or {@link BlockRenderLayer#SOLID}
+ * (which controls whether transparency can be in the texture).
*
placeHandler: Custom placement logic, used for things like Reactor Chambers within IC2 itself.
* Returning null for this uses the default logic (placing like a normal block).
*
dummyTe: An instance of the tile entity never registered to the world (don't try doing that) used for getting additional information about the Tile Entity.
* Mostly an internal thing, only exposed in case your Tile Entity uses a special constructor.
- *
- *
addSubBlocks: Called by BlockTileEntity to add all the ITeBlocks you want to the creative menu.
- * {@link BlockTileEntity#getItemStack(ITeBlock)} will be a useful method to get the item stack, a block instance is passed for that reason.
- * This is only called once on a random ITeBlock for the resource location, because they are internally stored in a {@link Set} so has no order.
- * Will probably be changed to a static method if/when the move is made to only Java 8 support.
*
* IMPORTANT THINGS TO NOTE
*
@@ -309,15 +279,17 @@ import ic2.api.tile.IWrenchable;
* For ItemBlockTileEntity, use {@link BlockTileEntity#getItem()}.
*
Using a custom item model for your ITeBlock
*
Implement ITeBlockSpecialItem along with ITeBlock, then the item model will be what's provided rather than the block model.
+ *
The default implementation for adding ITeBlocks to creative
+ *
The default logic adds all registered ITeBlocks that return true for {@link ic2.core.ref.TeBlock#hasItem()}.
*
* More will be added to this list if questions keep re-occurring, or are about a suitably important topic.
*
*
*
* There, that should be everything you need to utilise ITeBlock to add your own tile entities using IC2's very flexible framework.
- * I'll be happy to answer any questions you have on it, your best bet is to ask me (Chocohead) on the IC2 forums,
+ * I'll be happy to answer any questions you have on it, your best bet is to ask me (Chocohead) on the IC2 forums,
* although if you post in the support section other people might be able to help before I see your post.
- * I'll certainly take suggestions too, this is a first version of ITeBlock, so I'm sure there could be improvements made.
+ * I'll certainly take suggestions too, this is mostly just based on what IC2 uses/needs, so there might well be things missed that might be useful.
*
* Goodness I spent too long on this again...
*
@@ -327,16 +299,17 @@ import ic2.api.tile.IWrenchable;
* @see {@link ic2.core.ref.TeBlock} for how all the IC2 implements {@link ITeBlock}.
* @see {@link ic2.core.ref.TeBlock.HarvestTool} for the currently available tools (you'll need this for adding new tile entities).
* @see {@link ic2.core.ref.TeBlock.DefaultDrop} for the currently available drops (you'll need this for adding new tile entities too).
+ * @see {@link ic2.core.block.ITeBlock.ITeBlockCreativeRegisterer} for customising what blocks are added to creative past the default implementation
* @see {@link ic2.core.ref.TeBlock.ITePlaceHandler} for making your own block placement handler (example in {@link ic2.core.item.ItemHandlers#reactorChamberPlace}).
* @see {@link ic2.core.util.Util} for the useful facings you might want for supportedFacings.
* @see {@link ic2.core.block.TileEntityBlock} for the base tile entity.
* @see {@link ic2.core.block.BlockTileEntity} for the base block (you'll never need to construct this yourself).
- * @see {@link ic2.core.item.block.ItemBlockTileEntity} for the base item (you'll never need to construct this yourself either).
+ * @see {@link ic2.core.item.block.ItemBlockTileEntity} for the base item (you shouldn't need to construct this yourself either).
* @see {@link ITeBlockSpecialItem} for the interface used to have a custom item location.
*
*
- * @since IC2 2.6.114
- * @version 1.2
+ * @since IC2 2.7.14
+ * @version 2.0
*
* @author Chocohead
*/
diff --git a/src/api/java/ic2/api/info/Info.class b/src/api/java/ic2/api/info/Info.class
index 54987885d..9682d4754 100644
Binary files a/src/api/java/ic2/api/info/Info.class and b/src/api/java/ic2/api/info/Info.class differ
diff --git a/src/api/java/ic2/api/info/Info.java b/src/api/java/ic2/api/info/Info.java
index 8d3884216..619e04e53 100644
--- a/src/api/java/ic2/api/info/Info.java
+++ b/src/api/java/ic2/api/info/Info.java
@@ -25,7 +25,7 @@ public class Info {
public static boolean isIc2Available() {
if (ic2Available != null) return ic2Available;
- boolean loaded = Loader.isModLoaded("IC2");
+ boolean loaded = Loader.isModLoaded(MOD_ID);
if (Loader.instance().hasReachedState(LoaderState.CONSTRUCTING)) {
ic2Available = loaded;
@@ -34,5 +34,6 @@ public class Info {
return loaded;
}
+ public static String MOD_ID = "ic2";
private static Boolean ic2Available = null;
}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/item/IC2Items.class b/src/api/java/ic2/api/item/IC2Items.class
index a68e242fd..95a0eb820 100644
Binary files a/src/api/java/ic2/api/item/IC2Items.class and b/src/api/java/ic2/api/item/IC2Items.class differ
diff --git a/src/api/java/ic2/api/item/IC2Items.java b/src/api/java/ic2/api/item/IC2Items.java
index b0c113981..cee186861 100644
--- a/src/api/java/ic2/api/item/IC2Items.java
+++ b/src/api/java/ic2/api/item/IC2Items.java
@@ -5,6 +5,8 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
+import ic2.api.info.Info;
+
/**
* Provides access to IC2 blocks and items.
@@ -75,7 +77,7 @@ public final class IC2Items {
public static void setInstance(IItemAPI api) {
ModContainer mc = Loader.instance().activeModContainer();
- if (mc == null || !"IC2".equals(mc.getModId())) {
+ if (mc == null || !Info.MOD_ID.equals(mc.getModId())) {
throw new IllegalAccessError("invoked from "+mc);
}
diff --git a/src/api/java/ic2/api/item/IElectricItemManager.java b/src/api/java/ic2/api/item/IElectricItemManager.java
index 74964a24d..3c890d88f 100644
--- a/src/api/java/ic2/api/item/IElectricItemManager.java
+++ b/src/api/java/ic2/api/item/IElectricItemManager.java
@@ -94,7 +94,7 @@ public interface IElectricItemManager {
*
* @param stack electric item's stack
* @param amount amount of energy to discharge in EU
- * @param entity entity holding the item
+ * @param entity entity holding the item, may be null
* @return true if the operation succeeded
*/
boolean use(ItemStack stack, double amount, EntityLivingBase entity);
diff --git a/src/api/java/ic2/api/item/IItemHudProvider.class b/src/api/java/ic2/api/item/IItemHudProvider.class
index df596fec3..98e3cc056 100644
Binary files a/src/api/java/ic2/api/item/IItemHudProvider.class and b/src/api/java/ic2/api/item/IItemHudProvider.class differ
diff --git a/src/api/java/ic2/api/item/IItemHudProvider.java b/src/api/java/ic2/api/item/IItemHudProvider.java
index 47639b3b9..baeb68306 100644
--- a/src/api/java/ic2/api/item/IItemHudProvider.java
+++ b/src/api/java/ic2/api/item/IItemHudProvider.java
@@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
*
* @author Chocohead
*/
-public interface IItemHudProvider extends IElectricItem {
+public interface IItemHudProvider {
/**
* Whether the given stack should display the HUD overlay.
*
diff --git a/src/api/java/ic2/api/network/NetworkHelper.class b/src/api/java/ic2/api/network/NetworkHelper.class
index 055d909fb..87e27c3be 100644
Binary files a/src/api/java/ic2/api/network/NetworkHelper.class and b/src/api/java/ic2/api/network/NetworkHelper.class differ
diff --git a/src/api/java/ic2/api/network/NetworkHelper.java b/src/api/java/ic2/api/network/NetworkHelper.java
index 84d52cf3d..9e7bcfea1 100644
--- a/src/api/java/ic2/api/network/NetworkHelper.java
+++ b/src/api/java/ic2/api/network/NetworkHelper.java
@@ -9,6 +9,8 @@ import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.relauncher.Side;
+import ic2.api.info.Info;
+
/**
* Provides methods to initiate events and synchronize tile entity fields in SMP.
*
@@ -158,7 +160,7 @@ public final class NetworkHelper {
*/
public static void setInstance(INetworkManager server, INetworkManager client) {
ModContainer mc = Loader.instance().activeModContainer();
- if (mc == null || !"IC2".equals(mc.getModId())) {
+ if (mc == null || !Info.MOD_ID.equals(mc.getModId())) {
throw new IllegalAccessError();
}
serverInstance = server;
diff --git a/src/api/java/ic2/api/reactor/IReactor.class b/src/api/java/ic2/api/reactor/IReactor.class
index 3b27ee12f..7878499fb 100644
Binary files a/src/api/java/ic2/api/reactor/IReactor.class and b/src/api/java/ic2/api/reactor/IReactor.class differ
diff --git a/src/api/java/ic2/api/reactor/IReactor.java b/src/api/java/ic2/api/reactor/IReactor.java
index 63b5d6057..963cfa951 100644
--- a/src/api/java/ic2/api/reactor/IReactor.java
+++ b/src/api/java/ic2/api/reactor/IReactor.java
@@ -2,8 +2,6 @@ package ic2.api.reactor;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.math.BlockPos;
-import net.minecraft.world.World;
import ic2.api.info.ILocatable;
@@ -20,28 +18,6 @@ public interface IReactor extends ILocatable {
*/
public TileEntity getCoreTe();
- /**
- * Return the reactor's current world instance (it's position can be acquired using {@link #getReactorPos()}.
- *
- * Should be the same world as {@link #getCoreTe()} returns if it's not null.
- * @deprecated See {@link #getWorldObj()}
- *
- * @return The reactor's world object
- */
- @Deprecated //TODO: remove for 1.11
- public World getReactorWorld(); //getWorld has obfuscation issues (https://github.com/md-5/SpecialSource/issues/12)
-
- /**
- * Return the reactor's current position in the world ({@link #getReactorWorld()}.
- *
- * Should be the same position as {@link #getCoreTe()} returns if it's not null.
- * @deprecated See {@link #getPosition()}
- *
- * @return The reactor's current position
- */
- @Deprecated //TODO: remove for 1.11
- public BlockPos getReactorPos(); //As would getPos
-
/**
* Get the reactor's heat.
*
diff --git a/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.class b/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.class
new file mode 100644
index 000000000..31608e783
Binary files /dev/null and b/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.class differ
diff --git a/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.java b/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.java
new file mode 100644
index 000000000..86e725c0e
--- /dev/null
+++ b/src/api/java/ic2/api/recipe/IBasicMachineRecipeManager.java
@@ -0,0 +1,13 @@
+package ic2.api.recipe;
+
+import java.util.Collection;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public interface IBasicMachineRecipeManager extends IMachineRecipeManager, ItemStack> {
+ boolean addRecipe(IRecipeInput input, NBTTagCompound metadata, boolean replace, ItemStack... outputs);
+
+ @Deprecated
+ RecipeOutput getOutputFor(ItemStack input, boolean adjustInput);
+}
diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class
index 89a9b2f17..4b88cdf18 100644
Binary files a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class and b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$Input.class differ
diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$RawInput.class b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$RawInput.class
new file mode 100644
index 000000000..f7edd9fed
Binary files /dev/null and b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager$RawInput.class differ
diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class
index 7372a12c7..fc1013660 100644
Binary files a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class and b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.class differ
diff --git a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java
index 415b3c38c..6471e475e 100644
--- a/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java
+++ b/src/api/java/ic2/api/recipe/ICannerBottleRecipeManager.java
@@ -1,51 +1,57 @@
package ic2.api.recipe;
-import java.util.Map;
-
import net.minecraft.item.ItemStack;
-public interface ICannerBottleRecipeManager {
+import ic2.api.recipe.ICannerBottleRecipeManager.Input;
+import ic2.api.recipe.ICannerBottleRecipeManager.RawInput;
+
+public interface ICannerBottleRecipeManager extends IMachineRecipeManager {
/**
* Adds a recipe to the machine.
- *
+ *
* @param container Container to be filled
* @param fill Item to fill into the container
* @param output Filled container
+ * @return
*/
- public void addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output);
+ boolean addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output, boolean replace);
+
+ @Deprecated
+ void addRecipe(IRecipeInput container, IRecipeInput fill, ItemStack output);
/**
* Gets the recipe output for the given input.
- *
+ *
* @param container Container to be filled
* @param fill Item to fill into the container
* @param adjustInput modify the input according to the recipe's requirements
* @param acceptTest allow either container or fill to be null to see if either of them is part of a recipe
* @return Recipe output, or null if none
*/
- public RecipeOutput getOutputFor(ItemStack container, ItemStack fill, boolean adjustInput, boolean acceptTest);
-
- /**
- * Gets a list of recipes.
- *
- * You're a mad evil scientist if you ever modify this.
- *
- * @return List of recipes
- */
- public Map getRecipes();
-
+ @Deprecated
+ RecipeOutput getOutputFor(ItemStack container, ItemStack fill, boolean adjustInput, boolean acceptTest);
public static class Input {
- public Input(IRecipeInput container1, IRecipeInput fill1) {
- this.container = container1;
- this.fill = fill1;
+ public Input(IRecipeInput container, IRecipeInput fill) {
+ this.container = container;
+ this.fill = fill;
}
- public boolean matches(ItemStack container1, ItemStack fill1) {
- return this.container.matches(container1) && this.fill.matches(fill1);
+ public boolean matches(ItemStack container, ItemStack fill) {
+ return this.container.matches(container) && this.fill.matches(fill);
}
public final IRecipeInput container;
public final IRecipeInput fill;
}
+
+ public static class RawInput {
+ public RawInput(ItemStack container, ItemStack fill) {
+ this.container = container;
+ this.fill = fill;
+ }
+
+ public final ItemStack container;
+ public final ItemStack fill;
+ }
}
diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class
index b9899a9f2..8a00f0bcc 100644
Binary files a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class and b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$Input.class differ
diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$RawInput.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$RawInput.class
new file mode 100644
index 000000000..6d01f5efd
Binary files /dev/null and b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager$RawInput.class differ
diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class
index f32226dce..73118021f 100644
Binary files a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class and b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.class differ
diff --git a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java
index 5eba1b68e..f87a860be 100644
--- a/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java
+++ b/src/api/java/ic2/api/recipe/ICannerEnrichRecipeManager.java
@@ -1,54 +1,56 @@
package ic2.api.recipe;
-import java.util.Map;
-
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
-public interface ICannerEnrichRecipeManager {
+import ic2.api.recipe.ICannerEnrichRecipeManager.Input;
+import ic2.api.recipe.ICannerEnrichRecipeManager.RawInput;
+
+public interface ICannerEnrichRecipeManager extends IMachineRecipeManager {
/**
* Adds a recipe to the machine.
- *
+ *
* @param input Fluid input
* @param additive Item to enrich the fluid with
* @param output Output fluid
*/
+ @Deprecated
public void addRecipe(FluidStack input, IRecipeInput additive, FluidStack output);
/**
* Gets the recipe output for the given input.
- *
+ *
* @param input Fluid input
* @param additive Item to enrich the fluid with
* @param adjustInput modify the input according to the recipe's requirements
* @param acceptTest allow input or additive to be null to see if either of them is part of a recipe
* @return Recipe output, or null if none, output fluid in nbt
*/
+ @Deprecated
public RecipeOutput getOutputFor(FluidStack input, ItemStack additive, boolean adjustInput, boolean acceptTest);
- /**
- * Gets a list of recipes.
- *
- * You're a mad evil scientist if you ever modify this.
- *
- * @return List of recipes
- */
- public Map getRecipes();
-
-
public static class Input {
- public Input(FluidStack fluid1, IRecipeInput additive1) {
- this.fluid = fluid1;
- this.additive = additive1;
+ public Input(FluidStack fluid, IRecipeInput additive) {
+ this.fluid = fluid;
+ this.additive = additive;
}
- public boolean matches(FluidStack fluid1, ItemStack additive1) {
- return (this.fluid == null || this.fluid.isFluidEqual(fluid1)) &&
- this.additive.matches(additive1);
+ public boolean matches(FluidStack fluid, ItemStack additive) {
+ return this.fluid.isFluidEqual(fluid) && this.additive.matches(additive);
}
public final FluidStack fluid;
public final IRecipeInput additive;
}
+
+ public static class RawInput {
+ public RawInput(FluidStack fluid, ItemStack additive) {
+ this.fluid = fluid;
+ this.additive = additive;
+ }
+
+ public final FluidStack fluid;
+ public final ItemStack additive;
+ }
}
diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager$AttributeContainer.class b/src/api/java/ic2/api/recipe/ICraftingRecipeManager$AttributeContainer.class
new file mode 100644
index 000000000..26f2e3b87
Binary files /dev/null and b/src/api/java/ic2/api/recipe/ICraftingRecipeManager$AttributeContainer.class differ
diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class
index 877dcf4e7..abf33e484 100644
Binary files a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class and b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.class differ
diff --git a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java
index 756eaf634..7ff754571 100644
--- a/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java
+++ b/src/api/java/ic2/api/recipe/ICraftingRecipeManager.java
@@ -4,23 +4,42 @@ import net.minecraft.item.ItemStack;
/**
* Recipe manager interface for crafting recipes.
- *
+ *
* @author Richard
*/
public interface ICraftingRecipeManager {
/**
* Adds a shaped crafting recipe.
- *
+ *
* @param output Recipe output
* @param input Recipe input format
*/
public void addRecipe(ItemStack output, Object... input);
-
+
/**
* Adds a shapeless crafting recipe.
- *
+ *
* @param output Recipe output
* @param input Recipe input
*/
public void addShapelessRecipe(ItemStack output, Object... input);
-}
+
+ /**
+ * Attribute container to pass additional information to AdvRecipe and AdvShapelessRecipe
+ *
+ * @author Chocohead
+ */
+ public static class AttributeContainer {
+ public final boolean hidden;
+ public final boolean consuming;
+
+ /**
+ * @param hidden Whether the recipe is hidden from JEI by default
+ * @param consuming Whether containers should be consumed or returned empty
+ */
+ public AttributeContainer(boolean hidden, boolean consuming) {
+ this.hidden = hidden;
+ this.consuming = consuming;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager$Output.class b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager$Output.class
new file mode 100644
index 000000000..24704809b
Binary files /dev/null and b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager$Output.class differ
diff --git a/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.class b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.class
new file mode 100644
index 000000000..722df6032
Binary files /dev/null and b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.class differ
diff --git a/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.java b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.java
new file mode 100644
index 000000000..d301b41a5
--- /dev/null
+++ b/src/api/java/ic2/api/recipe/IEmptyFluidContainerRecipeManager.java
@@ -0,0 +1,25 @@
+package ic2.api.recipe;
+
+import java.util.Collection;
+
+import net.minecraft.item.ItemStack;
+
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+
+import ic2.api.recipe.IEmptyFluidContainerRecipeManager.Output;
+import ic2.api.util.FluidContainerOutputMode;
+
+public interface IEmptyFluidContainerRecipeManager extends IMachineRecipeManager {
+ MachineRecipeResult apply(ItemStack input, Fluid requiredFluid, FluidContainerOutputMode outputMode, boolean acceptTest);
+
+ public static class Output {
+ public Output(Collection container, FluidStack fluid) {
+ this.container = container;
+ this.fluid = fluid;
+ }
+
+ public final Collection container;
+ public final FluidStack fluid;
+ }
+}
diff --git a/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager$Input.class b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager$Input.class
new file mode 100644
index 000000000..9f813eba2
Binary files /dev/null and b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager$Input.class differ
diff --git a/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.class b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.class
new file mode 100644
index 000000000..42ddd10a7
Binary files /dev/null and b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.class differ
diff --git a/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.java b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.java
new file mode 100644
index 000000000..840fed83e
--- /dev/null
+++ b/src/api/java/ic2/api/recipe/IFillFluidContainerRecipeManager.java
@@ -0,0 +1,24 @@
+package ic2.api.recipe;
+
+import java.util.Collection;
+
+import net.minecraft.item.ItemStack;
+
+import net.minecraftforge.fluids.FluidStack;
+
+import ic2.api.recipe.IFillFluidContainerRecipeManager.Input;
+import ic2.api.util.FluidContainerOutputMode;
+
+public interface IFillFluidContainerRecipeManager extends IMachineRecipeManager, Input> {
+ MachineRecipeResult, Input> apply(Input input, FluidContainerOutputMode outputMode, boolean acceptTest);
+
+ public static class Input {
+ public Input(ItemStack container, FluidStack fluid) {
+ this.container = container;
+ this.fluid = fluid;
+ }
+
+ public final ItemStack container;
+ public final FluidStack fluid;
+ }
+}
diff --git a/src/api/java/ic2/api/recipe/IFluidRecipeManager$RecipeIoContainerFluid.class b/src/api/java/ic2/api/recipe/IFluidRecipeManager$RecipeIoContainerFluid.class
deleted file mode 100644
index d2fad7753..000000000
Binary files a/src/api/java/ic2/api/recipe/IFluidRecipeManager$RecipeIoContainerFluid.class and /dev/null differ
diff --git a/src/api/java/ic2/api/recipe/IFluidRecipeManager.class b/src/api/java/ic2/api/recipe/IFluidRecipeManager.class
deleted file mode 100644
index a6f3a2d4e..000000000
Binary files a/src/api/java/ic2/api/recipe/IFluidRecipeManager.class and /dev/null differ
diff --git a/src/api/java/ic2/api/recipe/IFluidRecipeManager.java b/src/api/java/ic2/api/recipe/IFluidRecipeManager.java
deleted file mode 100644
index 7cc662429..000000000
--- a/src/api/java/ic2/api/recipe/IFluidRecipeManager.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package ic2.api.recipe;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-
-import net.minecraftforge.fluids.FluidStack;
-
-
-/**
- * Recipe manager interface for machines that will probably never be added.
- *
- * @author estebes, Player
- */
-public interface IFluidRecipeManager {
- /**
- * Adds a recipe to the machine.
- *
- * @param input Fluid input
- * @param output Output fluid
- */
- public boolean addRecipe(IRecipeInput input, NBTTagCompound metadata, boolean replace, FluidStack... output);
-
- /**
- * Gets the recipe output for the given input.
- *
- * @param input Fluid input
- * @param adjustInput modify the input according to the recipe's requirements
- * @return Recipe output, or null if none, output fluid in nbt
- */
- public RecipeOutputFluid getOutputFor(ItemStack input, boolean adjustInput);
-
- /**
- * Get all registered recipes (optional operation).
- *
- * The method is only available if {@link #isIterable()} is true.
- * You're a mad evil scientist if you ever modify this.
- *
- * @return Iterable of all recipes registered to the manager.
- * @throws UnsupportedOperationException if {@link #isIterable()} is false.
- */
- public Iterable getRecipes();
-
- /**
- * Determine whether the recipes can be iterated.
- *
- * @return true if {@link #getRecipes()} is implemented, false otherwise.
- */
- public boolean isIterable();
-
-
- public static class RecipeIoContainerFluid {
- public RecipeIoContainerFluid(IRecipeInput input, RecipeOutputFluid output) {
- this.input = input;
- this.output = output;
- }
-
- public final IRecipeInput input;
- public final RecipeOutputFluid output;
- }
-}
diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager$RecipeIoContainer.class b/src/api/java/ic2/api/recipe/IMachineRecipeManager$RecipeIoContainer.class
deleted file mode 100644
index 0d21f7ada..000000000
Binary files a/src/api/java/ic2/api/recipe/IMachineRecipeManager$RecipeIoContainer.class and /dev/null differ
diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager.class b/src/api/java/ic2/api/recipe/IMachineRecipeManager.class
index 35823e21f..c3832b7e6 100644
Binary files a/src/api/java/ic2/api/recipe/IMachineRecipeManager.class and b/src/api/java/ic2/api/recipe/IMachineRecipeManager.class differ
diff --git a/src/api/java/ic2/api/recipe/IMachineRecipeManager.java b/src/api/java/ic2/api/recipe/IMachineRecipeManager.java
index efa62cc88..7126ad6b5 100644
--- a/src/api/java/ic2/api/recipe/IMachineRecipeManager.java
+++ b/src/api/java/ic2/api/recipe/IMachineRecipeManager.java
@@ -1,6 +1,5 @@
package ic2.api.recipe;
-import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/**
@@ -8,7 +7,7 @@ import net.minecraft.nbt.NBTTagCompound;
*
* @author Player, RichardG
*/
-public interface IMachineRecipeManager {
+public interface IMachineRecipeManager {
/**
* Adds a recipe to the machine.
*
@@ -19,21 +18,23 @@ public interface IMachineRecipeManager {
* @note Replace is only as reliable as IRecipeInput.getInputs().
*
* @param input Recipe input
+ * @param output Recipe outputs, zero or more depending on the machine.
* @param metadata Meta data for additional recipe properties, may be null.
* @param replace Replace conflicting existing recipes, not recommended, may be ignored.
- * @param outputs Recipe outputs, zero or more depending on the machine.
* @return true on success, false otherwise, e.g. on conflicts.
*/
- public boolean addRecipe(IRecipeInput input, NBTTagCompound metadata, boolean replace, ItemStack... outputs);
+ boolean addRecipe(RI input, RO output, NBTTagCompound metadata, boolean replace);
/**
- * Gets the recipe output for the given input.
+ * Gets the recipe result for the given input.
*
- * @param input Recipe input
- * @param adjustInput modify the input according to the recipe's requirements
- * @return Recipe output, or null if none
+ * @param input Recipe input (not modified)
+ * @param acceptTest If true the manager will accept partially missing ingredients or
+ * ingredients with insufficient quantities. This is primarily used to check whether a
+ * slot/tank/etc can accept the input while trying to supply a machine with resources.
+ * @return Recipe result, or null if none
*/
- public RecipeOutput getOutputFor(ItemStack input, boolean adjustInput);
+ MachineRecipeResult apply(I input, boolean acceptTest);
/**
* Get all registered recipes (optional operation).
@@ -44,23 +45,12 @@ public interface IMachineRecipeManager {
* @return Iterable of all recipes registered to the manager.
* @throws UnsupportedOperationException if {@link #isIterable()} is false.
*/
- public Iterable getRecipes();
+ Iterable extends MachineRecipe> getRecipes();
/**
* Determine whether the recipes can be iterated.
*
* @return true if {@link #getRecipes()} is implemented, false otherwise.
*/
- public boolean isIterable();
-
-
- public static class RecipeIoContainer {
- public RecipeIoContainer(IRecipeInput input, RecipeOutput output) {
- this.input = input;
- this.output = output;
- }
-
- public final IRecipeInput input;
- public final RecipeOutput output;
- }
+ boolean isIterable();
}
diff --git a/src/api/java/ic2/api/recipe/IScrapboxManager.class b/src/api/java/ic2/api/recipe/IScrapboxManager.class
index 2aa3304f1..80cf6ffd4 100644
Binary files a/src/api/java/ic2/api/recipe/IScrapboxManager.class and b/src/api/java/ic2/api/recipe/IScrapboxManager.class differ
diff --git a/src/api/java/ic2/api/recipe/IScrapboxManager.java b/src/api/java/ic2/api/recipe/IScrapboxManager.java
index 41b694dcc..f379e8dab 100644
--- a/src/api/java/ic2/api/recipe/IScrapboxManager.java
+++ b/src/api/java/ic2/api/recipe/IScrapboxManager.java
@@ -4,7 +4,7 @@ import java.util.Map;
import net.minecraft.item.ItemStack;
-public interface IScrapboxManager {
+public interface IScrapboxManager extends IBasicMachineRecipeManager {
void addDrop(ItemStack drop, float rawChance);
ItemStack getDrop(ItemStack input, boolean adjustInput);
diff --git a/src/api/java/ic2/api/recipe/MachineRecipe.class b/src/api/java/ic2/api/recipe/MachineRecipe.class
new file mode 100644
index 000000000..d8e05cb51
Binary files /dev/null and b/src/api/java/ic2/api/recipe/MachineRecipe.class differ
diff --git a/src/api/java/ic2/api/recipe/MachineRecipe.java b/src/api/java/ic2/api/recipe/MachineRecipe.java
new file mode 100644
index 000000000..af24cb654
--- /dev/null
+++ b/src/api/java/ic2/api/recipe/MachineRecipe.java
@@ -0,0 +1,35 @@
+package ic2.api.recipe;
+
+import net.minecraft.nbt.NBTTagCompound;
+
+public class MachineRecipe {
+ public MachineRecipe(I input, O output) {
+ this(input, output, null);
+ }
+
+ public MachineRecipe(I input, O output, NBTTagCompound meta) {
+ this.input = input;
+ this.output = output;
+ this.meta = meta;
+ }
+
+ public I getInput() {
+ return input;
+ }
+
+ public O getOutput() {
+ return output;
+ }
+
+ public NBTTagCompound getMetaData() {
+ return meta;
+ }
+
+ public MachineRecipeResult getResult(AI adjustedInput) {
+ return new MachineRecipeResult(this, adjustedInput);
+ }
+
+ private final I input;
+ private final O output;
+ private final NBTTagCompound meta;
+}
diff --git a/src/api/java/ic2/api/recipe/MachineRecipeResult.class b/src/api/java/ic2/api/recipe/MachineRecipeResult.class
new file mode 100644
index 000000000..09bb88f04
Binary files /dev/null and b/src/api/java/ic2/api/recipe/MachineRecipeResult.class differ
diff --git a/src/api/java/ic2/api/recipe/MachineRecipeResult.java b/src/api/java/ic2/api/recipe/MachineRecipeResult.java
new file mode 100644
index 000000000..9ed1a6f02
--- /dev/null
+++ b/src/api/java/ic2/api/recipe/MachineRecipeResult.java
@@ -0,0 +1,23 @@
+package ic2.api.recipe;
+
+public class MachineRecipeResult {
+ public MachineRecipeResult(MachineRecipe recipe, I adjustedInput) {
+ this.recipe = recipe;
+ this.adjustedInput = adjustedInput;
+ }
+
+ public MachineRecipe getRecipe() {
+ return recipe;
+ }
+
+ public RO getOutput() {
+ return recipe.getOutput();
+ }
+
+ public I getAdjustedInput() {
+ return adjustedInput;
+ }
+
+ private final MachineRecipe recipe;
+ private final I adjustedInput;
+}
diff --git a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class b/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class
deleted file mode 100644
index 01caff171..000000000
Binary files a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.class and /dev/null differ
diff --git a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.java b/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.java
deleted file mode 100644
index 545b3a398..000000000
--- a/src/api/java/ic2/api/recipe/RecipeInputFluidContainer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package ic2.api.recipe;
-
-import ic2.api.item.IC2Items;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.Fluid;
-
-/**
- * @deprecated Use {@link Recipes#inputFactory} instead.
- */
-@Deprecated
-public class RecipeInputFluidContainer implements IRecipeInput {
- public RecipeInputFluidContainer(Fluid fluid) {
- this(fluid, Fluid.BUCKET_VOLUME);
- }
-
- public RecipeInputFluidContainer(Fluid fluid, int amount) {
- this.fluid = fluid;
- this.amount = amount;
- }
-
- @Override
- public boolean matches(ItemStack subject) {
- /*FluidStack fs = FluidContainerRegistry.getFluidForFilledItem(subject);
-
- if (fs == null && subject.getItem() instanceof IFluidContainerItem) {
- IFluidContainerItem item = (IFluidContainerItem)subject.getItem();
- fs = item.getFluid(subject);
- }
-
- // match amount precisely to avoid having to deal with leftover
- return fs == null && fluid == null ||
- fs != null && fs.getFluid() == fluid && fs.amount >= amount;*/
- return false;
- }
-
- @Override
- public int getAmount() {
- return amount;
- }
-
- @Override
- public List getInputs() {
- List ret = new ArrayList();
-
- /*for (FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
- if (data.fluid.getFluid() != fluid) continue;
-
- ret.add(RecipeUtil.setImmutableSize(data.filledContainer, getAmount()));
- }*/
-
- ret.add(RecipeUtil.setImmutableSize(IC2Items.getItem("fluid_cell", fluid.getName()), getAmount()));
-
- return Collections.unmodifiableList(ret);
- }
-
- @Override
- public String toString() {
- return "RInputFluidContainer<"+amount+"x"+fluid.getName()+">";
- }
-
- public final Fluid fluid;
- public final int amount;
-}
diff --git a/src/api/java/ic2/api/recipe/RecipeInputItemStack.class b/src/api/java/ic2/api/recipe/RecipeInputItemStack.class
deleted file mode 100644
index adccec38f..000000000
Binary files a/src/api/java/ic2/api/recipe/RecipeInputItemStack.class and /dev/null differ
diff --git a/src/api/java/ic2/api/recipe/RecipeInputItemStack.java b/src/api/java/ic2/api/recipe/RecipeInputItemStack.java
deleted file mode 100644
index 459e6adf9..000000000
--- a/src/api/java/ic2/api/recipe/RecipeInputItemStack.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package ic2.api.recipe;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import net.minecraft.item.ItemStack;
-
-import net.minecraftforge.oredict.OreDictionary;
-
-/**
- * @deprecated Use {@link Recipes#inputFactory} instead.
- */
-@Deprecated
-public class RecipeInputItemStack implements IRecipeInput {
- public RecipeInputItemStack(ItemStack input) {
- this(input, input.getCount());
- }
-
- public RecipeInputItemStack(ItemStack input, int amount) {
- if (input.getItem() == null) throw new IllegalArgumentException("Invalid item stack specfied");
-
- this.input = input.copy(); // Never forget to copy.
- this.amount = amount;
- }
-
- @Override
- public boolean matches(ItemStack subject) {
- return subject.getItem() == input.getItem() && // Item matching
- (subject.getMetadata() == input.getMetadata() || input.getMetadata() == OreDictionary.WILDCARD_VALUE) && //meta matching
- (input.getMetadata() == OreDictionary.WILDCARD_VALUE || RecipeUtil.matchesNBT(subject.getTagCompound(), input.getTagCompound())); //nbt matching.
- }
-
- @Override
- public int getAmount() {
- return amount;
- }
-
- @Override
- public List getInputs() {
- return Collections.unmodifiableList(Arrays.asList(RecipeUtil.setImmutableSize(input, getAmount())));
- }
-
- @Override
- public String toString() {
- return "RInputItemStack<"+RecipeUtil.setImmutableSize(input, amount)+">";
- }
-
- public final ItemStack input;
- public final int amount;
-}
diff --git a/src/api/java/ic2/api/recipe/RecipeInputOreDict.class b/src/api/java/ic2/api/recipe/RecipeInputOreDict.class
deleted file mode 100644
index 705039579..000000000
Binary files a/src/api/java/ic2/api/recipe/RecipeInputOreDict.class and /dev/null differ
diff --git a/src/api/java/ic2/api/recipe/RecipeInputOreDict.java b/src/api/java/ic2/api/recipe/RecipeInputOreDict.java
deleted file mode 100644
index b2e26ee1e..000000000
--- a/src/api/java/ic2/api/recipe/RecipeInputOreDict.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package ic2.api.recipe;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-
-import net.minecraftforge.oredict.OreDictionary;
-
-/**
- * @deprecated Use {@link Recipes#inputFactory} instead.
- */
-@Deprecated
-public class RecipeInputOreDict implements IRecipeInput {
- public RecipeInputOreDict(String input) {
- this(input, 1);
- }
-
- public RecipeInputOreDict(String input, int amount) {
- this(input, amount, null);
- }
-
- public RecipeInputOreDict(String input, int amount, Integer meta) {
- this.input = input;
- this.amount = amount;
- this.meta = meta;
- }
-
- @Override
- public boolean matches(ItemStack subject) {
- List inputs = getOres();
- boolean useOreStackMeta = (meta == null);
- Item subjectItem = subject.getItem();
- int subjectMeta = subject.getItemDamage();
-
- for (ItemStack oreStack : inputs) {
- Item oreItem = oreStack.getItem();
- if (oreItem == null) continue; // ignore invalid
-
- int metaRequired = useOreStackMeta ? oreStack.getItemDamage() : meta;
-
- if (subjectItem == oreItem &&
- (subjectMeta == metaRequired || metaRequired == OreDictionary.WILDCARD_VALUE)) {
- return true;
- }
- }
-
- return false;
- }
-
- @Override
- public int getAmount() {
- return amount;
- }
-
- @Override
- public List getInputs() {
- List ores = getOres();
-
- // check if we have to filter the list first
- boolean hasUnsuitableEntries = false;
-
- for (ItemStack stack : ores) {
- if (stack.getItem() == null || stack.getCount() != getAmount()) {
- hasUnsuitableEntries = true;
- break;
- }
- }
-
- if (!hasUnsuitableEntries) return ores;
-
- List ret = new ArrayList(ores.size());
-
- for (ItemStack stack : ores) {
- if (stack.getItem() != null) { // ignore invalid
- ret.add(RecipeUtil.setImmutableSize(stack, getAmount()));
- }
- }
-
- return Collections.unmodifiableList(ret);
- }
-
- @Override
- public String toString() {
- if (meta == null) {
- return "RInputOreDict<"+amount+"x"+input+">";
- } else {
- return "RInputOreDict<"+amount+"x"+input+"@"+meta+">";
- }
- }
-
- private List getOres() {
- if (ores != null) return ores;
-
- // cache the ore list by making use of the fact that forge always uses the same list,
- // unless it's EMPTY_LIST, which should never happen.
- List ret = OreDictionary.getOres(input);
-
- if (ret != OreDictionary.EMPTY_LIST) ores = ret;
-
- return ret;
- }
-
- public final String input;
- public final int amount;
- public final Integer meta;
- private List ores;
-}
diff --git a/src/api/java/ic2/api/recipe/RecipeOutput.class b/src/api/java/ic2/api/recipe/RecipeOutput.class
index a2a19b3b1..0c83c13a1 100644
Binary files a/src/api/java/ic2/api/recipe/RecipeOutput.class and b/src/api/java/ic2/api/recipe/RecipeOutput.class differ
diff --git a/src/api/java/ic2/api/recipe/RecipeOutput.java b/src/api/java/ic2/api/recipe/RecipeOutput.java
index 80ad5fb5c..0f2fe1cba 100644
--- a/src/api/java/ic2/api/recipe/RecipeOutput.java
+++ b/src/api/java/ic2/api/recipe/RecipeOutput.java
@@ -7,6 +7,7 @@ import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+@Deprecated
public final class RecipeOutput {
public RecipeOutput(NBTTagCompound metadata1, List items1) {
assert !items1.contains(null);
diff --git a/src/api/java/ic2/api/recipe/RecipeOutputFluid.class b/src/api/java/ic2/api/recipe/RecipeOutputFluid.class
deleted file mode 100644
index ef597f4dd..000000000
Binary files a/src/api/java/ic2/api/recipe/RecipeOutputFluid.class and /dev/null differ
diff --git a/src/api/java/ic2/api/recipe/RecipeOutputFluid.java b/src/api/java/ic2/api/recipe/RecipeOutputFluid.java
deleted file mode 100644
index 750492245..000000000
--- a/src/api/java/ic2/api/recipe/RecipeOutputFluid.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package ic2.api.recipe;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import net.minecraft.nbt.NBTTagCompound;
-
-import net.minecraftforge.fluids.FluidStack;
-
-/**
- * @author estebes
- */
-public class RecipeOutputFluid {
- public RecipeOutputFluid(NBTTagCompound metadata, List outputs) {
- assert !outputs.contains(null);
-
- this.metadata = metadata;
- this.outputs = outputs;
- }
-
- public RecipeOutputFluid(NBTTagCompound metadata, FluidStack... outputs) {
- this(metadata, Arrays.asList(outputs));
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof RecipeOutputFluid) {
- RecipeOutputFluid ro = (RecipeOutputFluid) obj;
-
- if (outputs.size() == ro.outputs.size() &&
- (metadata == null && ro.metadata == null || metadata != null && ro.metadata != null && metadata.equals(ro.metadata))) {
- Iterator itA = outputs.iterator();
- Iterator itB = ro.outputs.iterator();
-
- while (itA.hasNext() && itB.hasNext()) {
- FluidStack stackA = itA.next();
- FluidStack stackB = itB.next();
-
- if (stackA.isFluidStackIdentical(stackB)) return false;
- }
-
- return true;
- }
- }
-
- return false;
- }
-
- @Override
- public String toString() {
- return "ROutput<"+outputs+","+metadata+">";
- }
-
- public final List outputs;
- public final NBTTagCompound metadata;
-}
diff --git a/src/api/java/ic2/api/recipe/RecipeUtil.class b/src/api/java/ic2/api/recipe/RecipeUtil.class
deleted file mode 100644
index eaf0c311c..000000000
Binary files a/src/api/java/ic2/api/recipe/RecipeUtil.class and /dev/null differ
diff --git a/src/api/java/ic2/api/recipe/RecipeUtil.java b/src/api/java/ic2/api/recipe/RecipeUtil.java
deleted file mode 100644
index 7c901af78..000000000
--- a/src/api/java/ic2/api/recipe/RecipeUtil.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package ic2.api.recipe;
-
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTBase;
-import net.minecraft.nbt.NBTTagCompound;
-
-class RecipeUtil {
- public static ItemStack setImmutableSize(ItemStack stack, int size) {
- if (stack.getCount() != size) {
- stack = stack.copy();
- stack.setCount(size);
- }
-
- return stack;
- }
-
- /**
- * Checks whether the first Compound has all tags, the second one has as well. Used for ItemStack matching.
- * @param subject The NBT to check.
- * @param target The NBT to match.
- * @return whether the first NBT has all tags equal to the one of the second.
- */
- public static boolean matchesNBT(NBTTagCompound subject, NBTTagCompound target) {
- if (subject == null) return target == null || target.hasNoTags();
- if (target == null) return true;
- for (String key : target.getKeySet()) {
- NBTBase targetNBT = target.getTag(key);
- if (!subject.hasKey(key) || targetNBT.getId() != subject.getTagId(key)) return false;
- NBTBase subjectNBT = subject.getTag(key);
- if (!targetNBT.equals(subjectNBT)) return false;
- }
- return true;
- }
-}
diff --git a/src/api/java/ic2/api/recipe/Recipes.class b/src/api/java/ic2/api/recipe/Recipes.class
index 6f4bb5a2b..1921c1c5b 100644
Binary files a/src/api/java/ic2/api/recipe/Recipes.class and b/src/api/java/ic2/api/recipe/Recipes.class differ
diff --git a/src/api/java/ic2/api/recipe/Recipes.java b/src/api/java/ic2/api/recipe/Recipes.java
index 214148129..c6cc0d753 100644
--- a/src/api/java/ic2/api/recipe/Recipes.java
+++ b/src/api/java/ic2/api/recipe/Recipes.java
@@ -1,5 +1,7 @@
package ic2.api.recipe;
+import net.minecraft.item.ItemStack;
+
/**
* General recipe registry.
*
@@ -34,33 +36,33 @@ public class Recipes {
/**
* Recipe manager for furnace recipes.
*
- *
No recipe meta.
- *
- * @deprecated currently unused/not implemented, uses the vanilla furnace recipe list
+ *
Recipe meta:
+ *
+ *
float experience: experience per smelt operation
+ *
*/
- @Deprecated
- public static IMachineRecipeManager furnace;
+ public static IMachineRecipeManager furnace;
/**
* Recipe manager for macerator recipes.
*
*
No recipe meta.
*/
- public static IMachineRecipeManager macerator;
+ public static IBasicMachineRecipeManager macerator;
/**
* Recipe manager for extractor recipes.
*
*
No recipe meta.
*/
- public static IMachineRecipeManager extractor;
+ public static IBasicMachineRecipeManager extractor;
/**
* Recipe manager for compressor recipes.
*
*
No recipe meta.
*/
- public static IMachineRecipeManager compressor;
+ public static IBasicMachineRecipeManager compressor;
/**
* Recipe manager for thermal centrifuge recipes.
@@ -70,7 +72,7 @@ public class Recipes {
*
int minHeat: minimum heat level required
*
*/
- public static IMachineRecipeManager centrifuge;
+ public static IBasicMachineRecipeManager centrifuge;
/**
* Recipe manager for blast cutter recipes.
@@ -80,7 +82,7 @@ public class Recipes {
*
int hardness: minimum blade hardness (3=iron, 6=steel, 9=diamond)
*
*/
- public static IMachineRecipeManager blockcutter;
+ public static IBasicMachineRecipeManager blockcutter;
/**
* Recipe manager for blast furnace recipes.
@@ -91,7 +93,7 @@ public class Recipes {
*
int duration: process duration (in ticks)
*
*/
- public static IMachineRecipeManager blastfurnace;
+ public static IBasicMachineRecipeManager blastfurnace;
/**
* Recipe manager for recycler recipes.
@@ -101,28 +103,28 @@ public class Recipes {
* @note the implementation is currently immutable, any non-blacklisted item will be accepted,
* chance checking is up to the caller.
*/
- public static IMachineRecipeManager recycler;
+ public static IBasicMachineRecipeManager recycler;
/**
* Recipe manager for metal former extrusion mode recipes.
*
*
No recipe meta.
*/
- public static IMachineRecipeManager metalformerExtruding;
+ public static IBasicMachineRecipeManager metalformerExtruding;
/**
* Recipe manager for metal former cutting mode recipes.
*
*
No recipe meta.
*/
- public static IMachineRecipeManager metalformerCutting;
+ public static IBasicMachineRecipeManager metalformerCutting;
/**
* Recipe manager for metal former rolling mode recipes.
*
*
No recipe meta.
*/
- public static IMachineRecipeManager metalformerRolling;
+ public static IBasicMachineRecipeManager metalformerRolling;
/**
* Recipe manager for ore washing plant recipes.
@@ -132,7 +134,7 @@ public class Recipes {
*
int amount: input fluid amount per cycle (in mB)
*
*/
- public static IMachineRecipeManager oreWashing;
+ public static IBasicMachineRecipeManager oreWashing;
public static ICannerBottleRecipeManager cannerBottle;
public static ICannerEnrichRecipeManager cannerEnrich;
public static IElectrolyzerRecipeManager electrolyzer;
@@ -141,10 +143,7 @@ public class Recipes {
/**
* Recipe manager for uu mass fabricator (matter gen) recipes.
*
- *
Recipe meta:
- *
- *
int amplification: amount of eu to be amplified per item (fixed +5x)
- *
+ *
No recipe meta.
*
*
Reference values:
*
@@ -152,7 +151,8 @@ public class Recipes {
*
45000: Scrapbox
*
*/
- public static IMachineRecipeManager matterAmplifier;
+ public static IMachineRecipeManager matterAmplifier;
+
/**
* Reference scrap box chance values:
*
@@ -184,4 +184,7 @@ public class Recipes {
* Opposite of {@link #liquidCooldownManager}. This is for Liquids that can be heated up again.
*/
public static ILiquidHeatExchangerManager liquidHeatupManager;
+
+ public static IEmptyFluidContainerRecipeManager emptyFluidContainer;
+ public static IFillFluidContainerRecipeManager fillFluidContainer;
}
diff --git a/src/api/java/ic2/api/tile/RotorRegistry.class b/src/api/java/ic2/api/tile/RotorRegistry.class
index 329ff28ad..45357043a 100644
Binary files a/src/api/java/ic2/api/tile/RotorRegistry.class and b/src/api/java/ic2/api/tile/RotorRegistry.class differ
diff --git a/src/api/java/ic2/api/tile/RotorRegistry.java b/src/api/java/ic2/api/tile/RotorRegistry.java
index dd652f2cc..132f0f9f5 100644
--- a/src/api/java/ic2/api/tile/RotorRegistry.java
+++ b/src/api/java/ic2/api/tile/RotorRegistry.java
@@ -8,6 +8,8 @@ import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.relauncher.SideOnly;
+import ic2.api.info.Info;
+
/**
* Helper class for registering {@link IRotorProvider}s to provide the default windmill renderer
*/
@@ -28,7 +30,7 @@ public class RotorRegistry {
*/
public static void setInstance(IRotorRegistry i) {
ModContainer mc = Loader.instance().activeModContainer();
- if (mc == null || !"IC2".equals(mc.getModId())) {
+ if (mc == null || !Info.MOD_ID.equals(mc.getModId())) {
throw new IllegalAccessError("Only IC2 can set the instance");
} else {
INSTANCE = i;
diff --git a/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.class b/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.class
new file mode 100644
index 000000000..98e28e1f5
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.class differ
diff --git a/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.java b/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.java
new file mode 100644
index 000000000..4a0ff0a89
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IAugmentationUpgrade.java
@@ -0,0 +1,20 @@
+package ic2.api.upgrade;
+
+import net.minecraft.item.ItemStack;
+
+/**
+ * An interface to mark an item as an {@link UpgradableProperty#Augmentable} type upgrade
+ *
+ * @author Player, Chocohead
+ */
+public interface IAugmentationUpgrade extends IUpgradeItem {
+ /**
+ * Gets the augmentation of the upgrade on the given {@link IUpgradableBlock}
+ *
+ * @param stack The upgrade stack
+ * @param parent The block being augmented
+ *
+ * @return The augmentation applied
+ */
+ int getAugmentation(ItemStack stack, IUpgradableBlock parent);
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.class b/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.class
new file mode 100644
index 000000000..a2a1a3099
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.class differ
diff --git a/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.java b/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.java
new file mode 100644
index 000000000..9c9a9e63a
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IEnergyStorageUpgrade.java
@@ -0,0 +1,30 @@
+package ic2.api.upgrade;
+
+import net.minecraft.item.ItemStack;
+
+/**
+ * An interface to mark an item as an {@link UpgradableProperty#EnergyStorage} type upgrade
+ *
+ * @author Player, Chocohead
+ */
+public interface IEnergyStorageUpgrade extends IUpgradeItem {
+ /**
+ * A raw value that is added to the {@link IUpgradableBlock}'s energy storage
+ *
+ * @param stack The upgrade stack
+ * @param parent The block storing energy
+ *
+ * @return The raw change in energy storage to be applied
+ */
+ int getExtraEnergyStorage(ItemStack stack, IUpgradableBlock parent);
+
+ /**
+ * A multiplier value that the {@link IUpgradableBlock}'s energy storage is affected by
+ *
+ * @param stack The upgrade stack
+ * @param parent The block storing energy
+ *
+ * @return The multiplier to be applied to be energy storage
+ */
+ double getEnergyStorageMultiplier(ItemStack stack, IUpgradableBlock parent);
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.class b/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.class
new file mode 100644
index 000000000..cc9dcfa8d
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.class differ
diff --git a/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.java b/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.java
new file mode 100644
index 000000000..f798452f4
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IFluidConsumingUpgrade.java
@@ -0,0 +1,10 @@
+package ic2.api.upgrade;
+
+/**
+ * An interface to mark an item as an {@link UpgradableProperty#FluidConsuming} type upgrade
+ *
+ * @author Player, Chocohead
+ */
+public interface IFluidConsumingUpgrade extends IUpgradeItem {
+
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.class b/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.class
new file mode 100644
index 000000000..2142df906
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.class differ
diff --git a/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.java b/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.java
new file mode 100644
index 000000000..f310a90f5
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IFluidProducingUpgrade.java
@@ -0,0 +1,10 @@
+package ic2.api.upgrade;
+
+/**
+ * An interface to mark an item as an {@link UpgradableProperty#FluidProducing} type upgrade
+ *
+ * @author Player, Chocohead
+ */
+public interface IFluidProducingUpgrade extends IUpgradeItem {
+
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/IFullUpgrade.class b/src/api/java/ic2/api/upgrade/IFullUpgrade.class
new file mode 100644
index 000000000..2e3ed4f98
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IFullUpgrade.class differ
diff --git a/src/api/java/ic2/api/upgrade/IFullUpgrade.java b/src/api/java/ic2/api/upgrade/IFullUpgrade.java
new file mode 100644
index 000000000..207786220
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IFullUpgrade.java
@@ -0,0 +1,12 @@
+package ic2.api.upgrade;
+
+/**
+ * An interface to mark an item supporting all {@link UpgradableProperty} type upgrades
+ *
+ * @author Player, Chocohead
+ */
+public interface IFullUpgrade extends IAugmentationUpgrade, IEnergyStorageUpgrade, IFluidConsumingUpgrade,
+ IFluidProducingUpgrade, IItemConsumingUpgrade, IItemProducingUpgrade, IProcessingUpgrade,
+ IRedstoneSensitiveUpgrade, ITransformerUpgrade {
+
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.class b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.class
new file mode 100644
index 000000000..b571d1dab
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.class differ
diff --git a/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.java b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.java
new file mode 100644
index 000000000..0a7216bc9
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IItemConsumingUpgrade.java
@@ -0,0 +1,10 @@
+package ic2.api.upgrade;
+
+/**
+ * An interface to mark an item as an {@link UpgradableProperty#ItemConsuming} type upgrade
+ *
+ * @author Player, Chocohead
+ */
+public interface IItemConsumingUpgrade extends IUpgradeItem {
+
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.class b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.class
new file mode 100644
index 000000000..e28bf01b6
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.class differ
diff --git a/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.java b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.java
new file mode 100644
index 000000000..85a3b9929
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IItemProducingUpgrade.java
@@ -0,0 +1,10 @@
+package ic2.api.upgrade;
+
+/**
+ * An interface to mark an item as an {@link UpgradableProperty#ItemProducing} type upgrade
+ *
+ * @author Player, Chocohead
+ */
+public interface IItemProducingUpgrade extends IUpgradeItem {
+
+}
diff --git a/src/api/java/ic2/api/upgrade/IProcessingUpgrade.class b/src/api/java/ic2/api/upgrade/IProcessingUpgrade.class
new file mode 100644
index 000000000..38402e890
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IProcessingUpgrade.class differ
diff --git a/src/api/java/ic2/api/upgrade/IProcessingUpgrade.java b/src/api/java/ic2/api/upgrade/IProcessingUpgrade.java
new file mode 100644
index 000000000..694b4687e
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IProcessingUpgrade.java
@@ -0,0 +1,50 @@
+package ic2.api.upgrade;
+
+import net.minecraft.item.ItemStack;
+
+/**
+ * An interface to mark an item as an {@link UpgradableProperty#Processing} type upgrade
+ *
+ * @author Player, Chocohead
+ */
+public interface IProcessingUpgrade extends IUpgradeItem {
+ /**
+ * A raw value that the process time is affected by (in ticks)
+ *
+ * @param stack The upgrade stack
+ * @param parent The {@link IUpgradableBlock} receiving the change
+ *
+ * @return The raw change in process to be applied
+ */
+ int getExtraProcessTime(ItemStack stack, IUpgradableBlock parent);
+
+ /**
+ * A multiplier value that the process time is affected by
+ *
+ * @param stack The upgrade stack
+ * @param parent The {@link IUpgradableBlock} receiving the change
+ *
+ * @return The multiplier to be applied to be progress
+ */
+ double getProcessTimeMultiplier(ItemStack stack, IUpgradableBlock parent);
+
+ /**
+ * A raw value that is added to the {@link IUpgradableBlock}'s energy demand
+ *
+ * @param stack The upgrade stack
+ * @param parent The block consuming energy
+ *
+ * @return The raw change in energy demand to be applied
+ */
+ int getExtraEnergyDemand(ItemStack stack, IUpgradableBlock parent);
+
+ /**
+ * A multiplier value that the {@link IUpgradableBlock}'s energy demand is affected by
+ *
+ * @param stack The upgrade stack
+ * @param parent The block consuming energy
+ *
+ * @return The multiplier to be applied to be energy demand
+ */
+ double getEnergyDemandMultiplier(ItemStack stack, IUpgradableBlock parent);
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.class b/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.class
new file mode 100644
index 000000000..9a215c5d7
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.class differ
diff --git a/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.java b/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.java
new file mode 100644
index 000000000..7c06a5afe
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IRedstoneSensitiveUpgrade.java
@@ -0,0 +1,31 @@
+package ic2.api.upgrade;
+
+import net.minecraft.item.ItemStack;
+
+/**
+ * An interface to mark an item as an {@link UpgradableProperty#RedstoneSensitive} type upgrade
+ *
+ * @author Player, Chocohead
+ */
+public interface IRedstoneSensitiveUpgrade extends IUpgradeItem {
+ /**
+ * Whether the upgrade modifies the given {@link IUpgradableBlock}'s redstone input
+ *
+ * @param stack The upgrade stack
+ * @param parent The block being modified
+ *
+ * @return Whether the redstone input should be changed (and thus {@link #getRedstoneInput(ItemStack, IUpgradableBlock, int)} be called)
+ */
+ boolean modifiesRedstoneInput(ItemStack stack, IUpgradableBlock parent);
+
+ /**
+ * Change the redstone input given the {@link IUpgradableBlock}'s initial input value
+ *
+ * @param stack The upgrade stack
+ * @param parent The block receiving the redstone signal
+ * @param externalInput The initial redstone signal
+ *
+ * @return The new redstone signal
+ */
+ int getRedstoneInput(ItemStack stack, IUpgradableBlock parent, int externalInput);
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/ITransformerUpgrade.class b/src/api/java/ic2/api/upgrade/ITransformerUpgrade.class
new file mode 100644
index 000000000..2d52de1f9
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/ITransformerUpgrade.class differ
diff --git a/src/api/java/ic2/api/upgrade/ITransformerUpgrade.java b/src/api/java/ic2/api/upgrade/ITransformerUpgrade.java
new file mode 100644
index 000000000..e6e2146cd
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/ITransformerUpgrade.java
@@ -0,0 +1,20 @@
+package ic2.api.upgrade;
+
+import net.minecraft.item.ItemStack;
+
+/**
+ * An interface to mark an item as an {@link UpgradableProperty#Transformer} type upgrade
+ *
+ * @author Player, Chocohead
+ */
+public interface ITransformerUpgrade extends IUpgradeItem {
+ /**
+ * Gets the additional tier that the given {@link IUpgradableBlock} can take
+ *
+ * @param stack The upgrade stack
+ * @param parent The block receiving energy
+ *
+ * @return The value to tier the tier by
+ */
+ int getExtraTier(ItemStack stack, IUpgradableBlock parent);
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/IUpgradableBlock.class b/src/api/java/ic2/api/upgrade/IUpgradableBlock.class
new file mode 100644
index 000000000..d533b246c
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IUpgradableBlock.class differ
diff --git a/src/api/java/ic2/api/upgrade/IUpgradableBlock.java b/src/api/java/ic2/api/upgrade/IUpgradableBlock.java
new file mode 100644
index 000000000..766761873
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IUpgradableBlock.java
@@ -0,0 +1,29 @@
+package ic2.api.upgrade;
+
+import java.util.Set;
+
+/**
+ * An interface to mark a block as supporting {@link IUpgradeItem}s
+ *
+ * @author Player
+ */
+public interface IUpgradableBlock {
+ /**
+ * @return The energy the block current has
+ */
+ double getEnergy();
+
+ /**
+ * Attempt to use the given amount of energy
+ *
+ * @param amount The amount of energy to be used
+ *
+ * @return Whether the energy was successfully used
+ */
+ boolean useEnergy(double amount);
+
+ /**
+ * @return The set of {@link UpgradableProperty}s that the block supports
+ */
+ Set getUpgradableProperties();
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/IUpgradeItem.class b/src/api/java/ic2/api/upgrade/IUpgradeItem.class
new file mode 100644
index 000000000..6432181d3
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/IUpgradeItem.class differ
diff --git a/src/api/java/ic2/api/upgrade/IUpgradeItem.java b/src/api/java/ic2/api/upgrade/IUpgradeItem.java
new file mode 100644
index 000000000..09e16a30b
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/IUpgradeItem.java
@@ -0,0 +1,44 @@
+package ic2.api.upgrade;
+
+import java.util.Collection;
+import java.util.Set;
+
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+
+/**
+ * An interface to mark an item as an upgrade for {@link IUpgradableBlock}s
+ *
+ * @author Player, Chocohead
+ */
+public interface IUpgradeItem {
+ /**
+ * Checks if the upgrade is valid for the given {@link UpgradableProperty} types
+ *
+ * @param stack The upgrade stack being checked
+ * @param types The list of types being tested
+ *
+ * @return Whether the upgrade is valid
+ */
+ boolean isSuitableFor(ItemStack stack, Set types);
+
+ /**
+ * Called every time the given {@link IUpgradableBlock} ticks
+ *
+ * @param stack The upgrade stack being ticked
+ * @param parent The parent block being ticked
+ *
+ * @return Whether to call {@link TileEntity#markDirty()} due to a stack changing
+ */
+ boolean onTick(ItemStack stack, IUpgradableBlock parent);
+
+ /**
+ * Called when the given {@link IUpgradableBlock} finishes processing
+ *
+ * @param stack The upgrade stack
+ * @param parent The parent finishing processing
+ * @param output The list of output products from the process, read only!
+ * @return final output
+ */
+ Collection onProcessEnd(ItemStack stack, IUpgradableBlock parent, Collection output);
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/UpgradableProperty.class b/src/api/java/ic2/api/upgrade/UpgradableProperty.class
new file mode 100644
index 000000000..7f5149878
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/UpgradableProperty.class differ
diff --git a/src/api/java/ic2/api/upgrade/UpgradableProperty.java b/src/api/java/ic2/api/upgrade/UpgradableProperty.java
new file mode 100644
index 000000000..17c575cf6
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/UpgradableProperty.java
@@ -0,0 +1,45 @@
+package ic2.api.upgrade;
+
+/**
+ * The possible properties an {@link IUpgradableBlock} can support
+ *
+ * @author Player
+ */
+public enum UpgradableProperty {
+ /**
+ * A block that processes something, taking upgrade process time + energy demand into account
+ */
+ Processing,
+ /**
+ * A simple count based upgrade property, e.g. extra range
+ */
+ Augmentable,
+ /**
+ * A block that is sensitive to redstone state/changes
+ */
+ RedstoneSensitive,
+ /**
+ * A block that can have it's tier changed
+ */
+ Transformer,
+ /**
+ * A block that can have the amount of energy it stores changed
+ */
+ EnergyStorage,
+ /**
+ * A block that consumes items
+ */
+ ItemConsuming,
+ /**
+ * A block that produces items
+ */
+ ItemProducing,
+ /**
+ * A block that consumes fluids
+ */
+ FluidConsuming,
+ /**
+ * A block that produces fluids
+ */
+ FluidProducing,
+}
\ No newline at end of file
diff --git a/src/api/java/ic2/api/upgrade/UpgradeRegistry.class b/src/api/java/ic2/api/upgrade/UpgradeRegistry.class
new file mode 100644
index 000000000..9059b9d15
Binary files /dev/null and b/src/api/java/ic2/api/upgrade/UpgradeRegistry.class differ
diff --git a/src/api/java/ic2/api/upgrade/UpgradeRegistry.java b/src/api/java/ic2/api/upgrade/UpgradeRegistry.java
new file mode 100644
index 000000000..8f6bed650
--- /dev/null
+++ b/src/api/java/ic2/api/upgrade/UpgradeRegistry.java
@@ -0,0 +1,38 @@
+package ic2.api.upgrade;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import net.minecraft.item.ItemStack;
+
+/**
+ * The registry that contains all known {@link IUpgradeItem}s
+ *
+ * @author Player
+ */
+public class UpgradeRegistry {
+ /**
+ * Register an upgrade itemstack to the registry
+ *
+ * @param stack The upgrade to register
+ *
+ * @return The stack that has been registered
+ */
+ public static ItemStack register(ItemStack stack) {
+ if (!(stack.getItem() instanceof IUpgradeItem)) throw new IllegalArgumentException("The stack must represent an IUpgradeItem.");
+
+ upgrades.add(stack);
+
+ return stack;
+ }
+
+ /**
+ * @return An unmodifiable list of registered upgrades
+ */
+ public static Iterable getUpgrades() {
+ return Collections.unmodifiableCollection(upgrades);
+ }
+
+ private static final List upgrades = new ArrayList();
+}
diff --git a/src/api/java/ic2/api/util/FluidContainerOutputMode.class b/src/api/java/ic2/api/util/FluidContainerOutputMode.class
new file mode 100644
index 000000000..43c42ccb6
Binary files /dev/null and b/src/api/java/ic2/api/util/FluidContainerOutputMode.class differ
diff --git a/src/api/java/ic2/api/util/FluidContainerOutputMode.java b/src/api/java/ic2/api/util/FluidContainerOutputMode.java
new file mode 100644
index 000000000..89812956b
--- /dev/null
+++ b/src/api/java/ic2/api/util/FluidContainerOutputMode.java
@@ -0,0 +1,18 @@
+package ic2.api.util;
+
+public enum FluidContainerOutputMode {
+ EmptyFullToOutput(true), // move only completely filled/drained containers to output
+ AnyToOutput(true), // move any containers to output if they changed
+ InPlacePreferred(false), // adjust the input stack if possible (size == 1)
+ InPlace(false); // always adjust the input stack
+
+ private FluidContainerOutputMode(boolean outputEmptyFull) {
+ this.outputEmptyFull = outputEmptyFull;
+ }
+
+ public boolean isOutputEmptyFull() {
+ return outputEmptyFull;
+ }
+
+ private final boolean outputEmptyFull;
+}
\ No newline at end of file
diff --git a/src/main/java/mekanism/common/integration/MekanismHooks.java b/src/main/java/mekanism/common/integration/MekanismHooks.java
index 2f76f3f1b..9d4bb08d8 100644
--- a/src/main/java/mekanism/common/integration/MekanismHooks.java
+++ b/src/main/java/mekanism/common/integration/MekanismHooks.java
@@ -1,10 +1,10 @@
package mekanism.common.integration;
-import ic2.api.recipe.IMachineRecipeManager.RecipeIoContainer;
-import ic2.api.recipe.RecipeInputItemStack;
-import ic2.api.recipe.RecipeInputOreDict;
+import ic2.api.recipe.IRecipeInput;
+import ic2.api.recipe.MachineRecipe;
import ic2.api.recipe.Recipes;
+import java.util.Collection;
import java.util.List;
import li.cil.oc.api.Driver;
@@ -76,11 +76,11 @@ public final class MekanismHooks
@Method(modid = "IC2")
public void hookIC2Recipes()
{
- for(RecipeIoContainer entry : Recipes.macerator.getRecipes())
+ for(MachineRecipe> entry : Recipes.macerator.getRecipes())
{
- if(!entry.input.getInputs().isEmpty())
+ if(!entry.getInput().getInputs().isEmpty())
{
- List names = MekanismUtils.getOreDictName(entry.input.getInputs().get(0));
+ List names = MekanismUtils.getOreDictName(entry.getInput().getInputs().get(0));
for(String name : names)
{
@@ -88,7 +88,7 @@ public final class MekanismHooks
if(name.startsWith("ingot"))
{
- RecipeHandler.addCrusherRecipe(entry.input.getInputs().get(0), entry.output.items.get(0));
+ RecipeHandler.addCrusherRecipe(entry.getInput().getInputs().get(0), entry.getOutput().iterator().next());
did = true;
}
@@ -101,28 +101,22 @@ public final class MekanismHooks
}
try {
- Recipes.macerator.addRecipe(new RecipeInputOreDict("oreOsmium"), null, false, new ItemStack(MekanismItems.Dust, 2, Resource.OSMIUM.ordinal()));
+ Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("oreOsmium"), null, false, new ItemStack(MekanismItems.Dust, 2, Resource.OSMIUM.ordinal()));
} catch(Exception e) {}
try {
- Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotOsmium"), null, false, new ItemStack(MekanismItems.Dust, 1, Resource.OSMIUM.ordinal()));
- Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotRefinedObsidian"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 5));
- Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotRefinedGlowstone"), null, false, new ItemStack(Items.GLOWSTONE_DUST));
- Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotSteel"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 1));
+ Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotOsmium"), null, false, new ItemStack(MekanismItems.Dust, 1, Resource.OSMIUM.ordinal()));
+ Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotRefinedObsidian"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 5));
+ Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotRefinedGlowstone"), null, false, new ItemStack(Items.GLOWSTONE_DUST));
+ Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotSteel"), null, false, new ItemStack(MekanismItems.OtherDust, 1, 1));
} catch(Exception e) {}
try {
for(Resource resource : Resource.values())
{
- Recipes.macerator.addRecipe(new RecipeInputOreDict("clump" + resource.getName()), null, false, new ItemStack(MekanismItems.DirtyDust, 1, resource.ordinal()));
+ Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("clump" + resource.getName()), null, false, new ItemStack(MekanismItems.DirtyDust, 1, resource.ordinal()));
}
} catch(Exception e) {}
-
- NBTTagCompound tag = new NBTTagCompound();
-
- tag.setInteger("amplification", 50000);
-
- Recipes.matterAmplifier.addRecipe(new RecipeInputItemStack(new ItemStack(MekanismItems.EnrichedAlloy), 1), tag, false);
}
@Method(modid = "ComputerCraft")
diff --git a/src/main/java/mekanism/common/integration/OreDictManager.java b/src/main/java/mekanism/common/integration/OreDictManager.java
index 690f5cde4..37ecf74de 100644
--- a/src/main/java/mekanism/common/integration/OreDictManager.java
+++ b/src/main/java/mekanism/common/integration/OreDictManager.java
@@ -1,6 +1,5 @@
package mekanism.common.integration;
-import ic2.api.recipe.RecipeInputOreDict;
import ic2.api.recipe.Recipes;
import java.util.ArrayList;
@@ -328,7 +327,7 @@ public final class OreDictManager
public static void addIC2BronzeRecipe()
{
try {
- Recipes.macerator.addRecipe(new RecipeInputOreDict("ingotBronze"), null, false, StackUtils.size(OreDictionary.getOres("dustBronze").get(0), 1));
+ Recipes.macerator.addRecipe(Recipes.inputFactory.forOreDict("ingotBronze"), null, false, StackUtils.size(OreDictionary.getOres("dustBronze").get(0), 1));
} catch(Exception e) {}
}