aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
authorkorneel vandamme <Krampus.sack.never@gmail.com>2020-11-20 03:15:33 +0100
committerkorneel vandamme <Krampus.sack.never@gmail.com>2020-11-20 03:15:33 +0100
commitdc56ad792448b7e5caa489841c71926a81afb840 (patch)
tree5ad2003d6031cbd6e98e07aea5f8f2af084af299 /src/main/java/gregtech/api
parent997abcd915717c11dd7bd1423e41512cb1446e53 (diff)
downloadGT5-Unofficial-dc56ad792448b7e5caa489841c71926a81afb840.tar.gz
GT5-Unofficial-dc56ad792448b7e5caa489841c71926a81afb840.tar.bz2
GT5-Unofficial-dc56ad792448b7e5caa489841c71926a81afb840.zip
add suport for drawers and barrels
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index 9f39ac3522..b06cc1d82a 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -546,27 +546,28 @@ public class GT_Utility {
for (int tGrabSlot = 0;tGrabSlot<tGrabInventorySize;tGrabSlot++)
{
//ItemStack tInventoryStack : mInventory
- ItemStack tGrabStack = aTileEntity1.getStackInSlot(tGrabSlot);
- if (listContainsItem(aFilter, tGrabStack, true, aInvertFilter) &&
- (tGrabStack.stackSize >= aMinMoveAtOnce && isAllowedToTakeFromSlot(aTileEntity1, tGrabSlot, aGrabFrom, tGrabStack))) {
- int tStackSize = tGrabStack.stackSize;
- int tMovedItems = 0;
- for (int tPutSlot = tFirstsValidSlot;tPutSlot<tPutInventorySize;tPutSlot++)
- {
- if (isAllowedToPutIntoSlot(tPutInventory,tPutSlot,aPutTo,tGrabStack,(byte)64))
- {
- int tMoved = moveStackFromSlotAToSlotB(aTileEntity1, tPutInventory, tGrabSlot, tPutSlot, aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItems), aMinMoveAtOnce);
- tTotalItemsMoved += tMoved;
- tMovedItems += tMoved;
- if (tMovedItems == tStackSize)
- break;
+ int tMovedItems = 0;
+ do {
+ ItemStack tGrabStack = aTileEntity1.getStackInSlot(tGrabSlot);
+ if (listContainsItem(aFilter, tGrabStack, true, aInvertFilter) &&
+ (tGrabStack.stackSize >= aMinMoveAtOnce && isAllowedToTakeFromSlot(aTileEntity1, tGrabSlot, aGrabFrom, tGrabStack))) {
+ int tStackSize = tGrabStack.stackSize;
+ tMovedItems = 0;
+ for (int tPutSlot = tFirstsValidSlot; tPutSlot < tPutInventorySize; tPutSlot++) {
+ if (isAllowedToPutIntoSlot(tPutInventory, tPutSlot, aPutTo, tGrabStack, (byte) 64)) {
+ int tMoved = moveStackFromSlotAToSlotB(aTileEntity1, tPutInventory, tGrabSlot, tPutSlot, aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItems), aMinMoveAtOnce);
+ tTotalItemsMoved += tMoved;
+ tMovedItems += tMoved;
+ if (tMovedItems == tStackSize)
+ break;
+ }
+ }
+ if (tMovedItems > 0) {
+ if (++tStacksMoved >= aMaxStackTransfer)
+ return tTotalItemsMoved;
}
}
- if (tMovedItems > 0) {
- if (++tStacksMoved >= aMaxStackTransfer)
- return tTotalItemsMoved;
- }
- }
+ } while (tGrabInventorySize == 2 && tMovedItems > 0); //to suport draweres and barrels
}
if (aDoCheckChests && aTileEntity1 instanceof TileEntityChest) {
TileEntityChest tTileEntity1 = (TileEntityChest) aTileEntity1;