From 21f2727b327f129d1f73da4aa3069c3fed492bfb Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 3 Dec 2024 22:22:01 +0100 Subject: [PATCH] fixed requestExistingItem returning an incorrect amount of already requested items closes #229 --- .../prettypipes/network/PipeNetwork.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) 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) {