Mekanism-tilera-Edition/common/mekanism/api/PressurizedProducts.java

54 lines
909 B
Java
Raw Normal View History

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