2014-04-04 03:34:33 +02:00
|
|
|
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;
|
2014-04-04 03:34:33 +02:00
|
|
|
|
|
|
|
private GasStack gasOutput;
|
|
|
|
|
2014-04-06 02:16:09 +02:00
|
|
|
public PressurizedProducts(ItemStack item, GasStack gas)
|
2014-04-04 03:34:33 +02:00
|
|
|
{
|
2014-04-06 02:16:09 +02:00
|
|
|
itemOutput = item;
|
2014-04-04 03:34:33 +02:00
|
|
|
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-04 03:34:33 +02:00
|
|
|
{
|
2014-04-06 02:16:09 +02:00
|
|
|
if(inventory[index] == null)
|
|
|
|
{
|
|
|
|
inventory[index] = itemOutput.copy();
|
|
|
|
}
|
|
|
|
else if(inventory[index].isItemEqual(itemOutput))
|
2014-04-04 03:34:33 +02:00
|
|
|
{
|
2014-04-06 02:16:09 +02:00
|
|
|
inventory[index].stackSize += itemOutput.stackSize;
|
2014-04-04 03:34:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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());
|
|
|
|
}
|
|
|
|
|
2014-04-04 03:34:33 +02:00
|
|
|
}
|