Mekanism-tilera-Edition/common/mekanism/api/PressurizedProducts.java
2014-04-06 01:16:09 +01:00

53 lines
909 B
Java

package mekanism.api;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import net.minecraft.item.ItemStack;
public class PressurizedProducts
{
private ItemStack itemOutput;
private GasStack gasOutput;
public PressurizedProducts(ItemStack item, GasStack gas)
{
itemOutput = item;
gasOutput = gas;
}
public void fillTank(GasTank tank)
{
tank.receive(gasOutput, true);
}
public void addProducts(ItemStack[] inventory, int index)
{
if(inventory[index] == null)
{
inventory[index] = itemOutput.copy();
}
else if(inventory[index].isItemEqual(itemOutput))
{
inventory[index].stackSize += itemOutput.stackSize;
}
}
public ItemStack getOptionalOutput()
{
return itemOutput;
}
public GasStack getGasOutput()
{
return gasOutput;
}
public PressurizedProducts copy()
{
return new PressurizedProducts(itemOutput.copy(), gasOutput.copy());
}
}