Consume energy when pulling from ISpecialInventory. Also pull multiple stacks if energy permits.
This commit is contained in:
parent
51b8e73f26
commit
667bad3b92
1 changed files with 9 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue