diff --git a/New Attempts/Mining.lua b/New Attempts/Mining.lua index 8b320bc..9ef617e 100644 --- a/New Attempts/Mining.lua +++ b/New Attempts/Mining.lua @@ -341,19 +341,30 @@ function returnItems() faceTo(-1, 0) - -- already facing right direction, put items - for slot = 1, maxCompareSlot do - -- put away compare slots' items except one - turtle.select(slot) - turtle.drop(turtle.getItemCount(slot) - 1) - end - for slot = maxCompareSlot + 1, 16 do - -- then drop everything else - if (turtle.getItemCount(slot) == 0) then + local droppedAll = true + + while true do + droppedAll = true + -- already facing right direction, put items + for slot = 1, maxCompareSlot do + -- put away compare slots' items except one + turtle.select(slot) + turtle.drop(turtle.getItemCount(slot) - 1) + if (turtle.getItemCount(slot) ~= 1) then + droppedAll = false + end + end + for slot = maxCompareSlot + 1, 16 do + -- then drop everything else + turtle.select(slot) + turtle.drop() + if (turtle.getItemCount(slot) ~= 0) then + droppedAll = false + end + end + if (droppedAll) then break end - turtle.select(slot) - turtle.drop() end -- necessary so the next mined block doesn't go in random places