diff --git a/coal-crafter.lua b/coal-crafter.lua index 0267bb7..a7d586c 100644 --- a/coal-crafter.lua +++ b/coal-crafter.lua @@ -19,16 +19,26 @@ local function waitForCoalEssence(inventory) end end +local function strictTransferOne(slot) + local ok = turtle.transferTo(slot, 1) + + if not ok then + error('cannot transfer item') + end + + return ok +end + local function prepareCraftShape() - turtle.transferTo(2, 1) - turtle.transferTo(3, 1) + strictTransferOne(2) + strictTransferOne(3) - turtle.transferTo(5, 1) - turtle.transferTo(7, 1) + strictTransferOne(5) + strictTransferOne(7) - turtle.transferTo(9, 1) - turtle.transferTo(10, 1) - turtle.transferTo(11, 1) + strictTransferOne(9) + strictTransferOne(10) + strictTransferOne(11) end local function craft()