aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2020-08-01 18:56:21 +0200
committerGitHub <noreply@github.com>2020-08-01 18:56:21 +0200
commit2065943f0f68d99274935610459ffa9849418bf5 (patch)
tree12ae8df0168b0bf153c27e92af03ab1a88c95f6b
parent9c2739de755da6d46de162126d85000f7d28aafb (diff)
parente703df6cde3a293222702e7c7cc3109c1e5a6289 (diff)
downloadGT5-Unofficial-2065943f0f68d99274935610459ffa9849418bf5.tar.gz
GT5-Unofficial-2065943f0f68d99274935610459ffa9849418bf5.tar.bz2
GT5-Unofficial-2065943f0f68d99274935610459ffa9849418bf5.zip
Merge pull request #306 from hohounk/experimental
Simple optimization to GT_Utility.moveOneItemStack
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index f5dfb42a2c..6df77f16bf 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -559,14 +559,14 @@ public class GT_Utility {
for (int i = 0; i < tGrabSlots.length; i++) {
byte tMovedItemCount = 0;
- for (int j = 0; j < tPutSlots.length; j++) {
- if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(tGrabSlots[i]), true, aInvertFilter)) {
- if (isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, aTileEntity1.getStackInSlot(tGrabSlots[i]))) {
- if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, tPutSlots[j], aPutTo, aTileEntity1.getStackInSlot(tGrabSlots[i]), aMaxTargetStackSize)) {
- tMovedItemCount += moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], tPutSlots[j], aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce);
+ ItemStack tGrabStack = aTileEntity1.getStackInSlot(tGrabSlots[i]);
+ if (listContainsItem(aFilter, tGrabStack, true, aInvertFilter)) {
+ if (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) {
return tMovedItemCount;
-
}
}
}