Skip to content

Commit 943d9d7

Browse files
committed
Minor performance improvement to TransporterManager's simulation, exit early if the slot is already full
1 parent b6cb563 commit 943d9d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/mekanism/common/content/transporter/TransporterManager.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ private static int simulateInsert(IItemHandler handler, InventoryInfo inventoryI
6464
int mergedCount = count + destCount;
6565
boolean needsSimulation = false;
6666
if (destCount > 0) {
67-
if (!InventoryUtils.areItemsStackable(inventoryInfo.inventory.get(slot), stack)) {
68-
//If the destination isn't empty and not stackable, move along
67+
if (!InventoryUtils.areItemsStackable(inventoryInfo.inventory.get(slot), stack) || destCount >= max) {
68+
//If the destination isn't empty and not stackable or it is currently full, move along
6969
continue;
7070
} else if (max > maxStackSize && mergedCount > maxStackSize) {
7171
//If we have items in the destination, and the max amount is larger than

0 commit comments

Comments
 (0)