diff --git a/coal-crafter.lua b/coal-crafter.lua index 592328e..fe76098 100644 --- a/coal-crafter.lua +++ b/coal-crafter.lua @@ -25,7 +25,7 @@ local function dropAll(side, dropFn) turtleUtils.waitForInventory(side, IDLE_TIME) local errorPrinted = false - while not turtleUtils.dropSlot(i, dropFn) do + while turtle.getItemCount(i) > 0 and not turtleUtils.dropSlot(i, dropFn) do if not errorPrinted then print('> please empty the turtle inventory') errorPrinted = true @@ -140,6 +140,10 @@ local function main() print('> drop all') dropAll(STORAGE_INVENTORY_SIDE, dropInStorageFn) + if not turtleUtils.isInventoryEmpty() then + error('Error: inventory is not empty', 0) + end + turtle.select(CRAFTING_SLOT) print('> coal-crafter process started')