From 3a07aac9a56e9f340954e9092aecf85ba648c405 Mon Sep 17 00:00:00 2001 From: moller21 <42100910+moller21@users.noreply.github.com> Date: Sun, 23 Aug 2020 15:33:20 +0200 Subject: Attempt at improving chest buffers, also slowing down lower tier ones. --- src/main/java/gregtech/api/util/GT_Utility.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main/java/gregtech/api/util/GT_Utility.java') diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 6df77f16bf..a65ed00aed 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -547,7 +547,7 @@ public class GT_Utility { for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i; } - if (aTileEntity2 != null && aTileEntity2 instanceof IInventory) { + if (aTileEntity2 instanceof IInventory) { int[] tPutSlots = null; if (aTileEntity2 instanceof ISidedInventory) tPutSlots = ((ISidedInventory) aTileEntity2).getAccessibleSlotsFromSide(aPutTo); @@ -561,13 +561,12 @@ public class GT_Utility { byte tMovedItemCount = 0; ItemStack tGrabStack = aTileEntity1.getStackInSlot(tGrabSlots[i]); if (listContainsItem(aFilter, tGrabStack, true, aInvertFilter)) { - if (isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, tGrabStack)) { + if (tGrabStack.stackSize >= aMinMoveAtOnce && isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, tGrabStack)) { for (int j = 0; j < tPutSlots.length; j++) { if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, tPutSlots[j], aPutTo, tGrabStack, aMaxTargetStackSize)) { tMovedItemCount += moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], tPutSlots[j], aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce); - if (tMovedItemCount >= aMaxMoveAtOnce) { + if (tMovedItemCount >= aMaxMoveAtOnce ||(tMovedItemCount > 0 && aMaxTargetStackSize < 64)) return tMovedItemCount; - } } } } -- cgit