Merge pull request #217 from taralx/master

Consume power when pulling from ISpecialInventory.
This commit is contained in:
SirSengir 2012-09-06 01:20:23 -07:00
commit ff16f89921

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;