Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local dim = read()
- turtle.select(1)
- local detail = turtle.getItemDetail()
- local count = 1
- local notEmptyCount = 0
- function digBlock()
- if turtle.detect() then
- turtle.dig()
- end
- end
- function allEmpty()
- isEmpty = false
- for i = 1, 16, 1 do
- turtle.select(i)
- if turtle.getItemDetail() ~= nil then
- if turtle.getItemCount() ~= 0 then
- if turtle.getItemDetail().name == detail.name then
- notEmptyCount = notEmptyCount + 1
- end
- end
- end
- end
- if notEmptyCount == 0 then
- isEmpty = true
- end
- return isEmpty
- end
- for j = 0, dim-1, 1 do
- for i = 0, dim-1, 1 do
- digBlock()
- turtle.forward()
- turtle.turnRight()
- turtle.turnRight()
- if turtle.getItemCount() == 0 or turtle.getItemDetail().name ~= detail.name then
- for k = 1, 16, 1 do
- turtle.select(k)
- if turtle.getItemDetail() ~= nil then
- if turtle.getItemDetail().name == detail.name then
- count = k
- break
- end
- end
- end
- end
- turtle.select(count)
- turtle.place()
- turtle.turnRight()
- turtle.turnRight()
- end
- digBlock()
- if j % 2 == 0 then
- turtle.turnRight()
- digBlock()
- turtle.forward()
- turtle.turnRight()
- digBlock()
- turtle.forward()
- else
- turtle.turnLeft()
- digBlock()
- turtle.forward()
- turtle.turnLeft()
- digBlock()
- turtle.forward()
- end
- end
Add Comment
Please, Sign In to add comment