Consume energy when pulling from ISpecialInventory. Also pull multiple stacks if energy permits.

This commit is contained in:
JP Sugarbroad 2012-09-05 22:02:33 -07:00
parent 51b8e73f26
commit 667bad3b92

View file

@ -127,8 +127,15 @@ public class PipeItemsWood extends Pipe implements IPowerReceptor {
public ItemStack[] checkExtract(IInventory inventory, boolean doRemove, Orientations from) {
/// ISPECIALINVENTORY
if (inventory instanceof ISpecialInventory)
return ((ISpecialInventory) inventory).extractItem(doRemove, from, 1);
if (inventory instanceof ISpecialInventory) {
ItemStack[] stacks = ((ISpecialInventory) inventory).extractItem(doRemove, from, (int)powerProvider.getEnergyStored());
if (stacks != null && doRemove) {
for (ItemStack stack : stacks) {
powerProvider.useEnergy(stack.stackSize, stack.stackSize, true);
}
}
return stacks;
}
if (inventory instanceof ISidedInventory) {
ISidedInventory sidedInv = (ISidedInventory) inventory;