From 2459348faa4813e4a4fa9e0b561ca6009ffe2f10 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 25 Oct 2022 10:21:20 +0200 Subject: [PATCH] avoid unnecessarily copying stacks in getAvailableDestination --- src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java index 5274229..657c5b1 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java @@ -239,8 +239,8 @@ public class PipeBlockEntity extends BlockEntity implements MenuProvider, IPipeC } // totalSpace will be the amount of items that fit into the attached container var totalSpace = 0; + var copy = stack.copy(); for (var i = startSlot; i < slotAmount; i++) { - var copy = stack.copy(); var maxStackSize = copy.getMaxStackSize(); // if the container can store more than 64 items in this slot, then it's likely // a barrel or similar, meaning that the slot limit matters more than the max stack size