Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = { ... }
- local function turnTo(block)
- while true do
- if turtle.detect() then
- local success, data = turtle.inspect()
- if data.name == block then
- break
- end
- end
- turtle.turnLeft()
- end
- end
- local function fillSlot(slot)
- turtle.select(slot)
- while turtle.getItemCount() < 1 do
- turtle.suck(1)
- end
- end
- local function craftLoopIteration()
- turnTo(args[1])
- for y = 1, 4, 1 do
- for x = 1, 4, 1 do
- if x ~= 4 and y ~= 4 then
- local slot = (y - 1) * 4 + x
- fillSlot(slot)
- end
- end
- end
- turtle.select(1)
- turtle.craft()
- turnTo(args[2])
- turtle.drop()
- end
- if type(args[1]) ~= "string" or type(args[2]) ~= "string" then
- print("Usage: compactor <source_invenory> <output_inventory>")
- else
- while true do
- craftLoopIteration()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement