diff options
author | Martin Robertz <dream-master@gmx.net> | 2020-08-24 20:37:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-24 20:37:50 +0200 |
commit | 8d3a5c833713d56fbcd580db60b87872b4b6994f (patch) | |
tree | 9c0263df92aeb5690c602ef9e1fb6235e84ebe41 /src/main/java/gregtech/api/util/GT_Utility.java | |
parent | 2c0eeef43712d9f6b5e3461ee75e91638c950c81 (diff) | |
parent | b403f91a2f38ca5f8ea94732cab4e776e46c4e7a (diff) | |
download | GT5-Unofficial-8d3a5c833713d56fbcd580db60b87872b4b6994f.tar.gz GT5-Unofficial-8d3a5c833713d56fbcd580db60b87872b4b6994f.tar.bz2 GT5-Unofficial-8d3a5c833713d56fbcd580db60b87872b4b6994f.zip |
Merge pull request #309 from moller21/experimental
Make chest buffers reduce server load.
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_Utility.java')
-rw-r--r-- | src/main/java/gregtech/api/util/GT_Utility.java | 7 |
1 files changed, 3 insertions, 4 deletions
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; - } } } } |