diff --git a/src/lib/turtle/InvManager.hx b/src/lib/turtle/InvManager.hx index 84e29ca..26d7a77 100644 --- a/src/lib/turtle/InvManager.hx +++ b/src/lib/turtle/InvManager.hx @@ -142,6 +142,7 @@ class InvManager { while (loopProtect > 0) { loopProtect--; + if (topIndex < k) { return; } @@ -159,10 +160,9 @@ class InvManager { Log.error("Failed to transfer items"); } - // Update invState var topState = invState.get(slots[topIndex]); topState.count += transferCount; - invState.set(topIndex, topState); + invState.set(slots[topIndex], topState); var botState = invState.get(slot); botState.count -= transferCount; @@ -174,6 +174,10 @@ class InvManager { break; } } + + if (loopProtect < 0) { + Log.silly("Loopprotection triggerd"); + } } } }