diff --git a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java index c68035e..652dbf6 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java +++ b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java @@ -280,28 +280,27 @@ public class PipeNetwork extends SavedData implements GraphListener itemSupplier.apply(extracted, speed))) { handler.extractItem(slot, extracted.getCount(), false); - amount -= extracted.getCount(); - if (amount <= 0) + extractedSoFar += extracted.getCount(); + if (extractedSoFar >= toExtract) break; } } // we reduce the amount by what we managed to extract & insert in the for loop, so the amount down here will be what we couldn't - return stack.copyWithCount(amount); + return stack.copyWithCount(stack.getCount() - extractedSoFar); } public PipeBlockEntity getPipe(BlockPos pos) {