Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function turnLeft(Times)
- Times = Times or 1
- for _ = 1, Times do
- turtle.turnLeft()
- end
- end
- local function turnRight(Times)
- Times = Times or 1
- for _ = 1, Times do
- turtle.turnRight()
- end
- end
- local function DigAndCollect(Side)
- Side = not Side and "f" or string.lower(Side)
- if Side == "f" then
- turtle.dig()
- elseif Side == "l" then
- turnLeft()
- turtle.dig()
- elseif Side == "r" then
- turnRight()
- turtle.dig()
- turnLeft()
- elseif Side == "b" then
- turnLeft(2)
- turtle.dig()
- turnLeft(2)
- elseif Side == "u" then
- turtle.digUp()
- turtle.suckUp()
- return;
- elseif Side == "d" then
- turtle.digDown()
- turtle.suckDown()
- return;
- end
- turtle.suck()
- end
- local Distance = 0;
- while true do
- if Distance == 100 then
- DigAndCollect("l")
- turtle.forward()
- turnLeft()
- end
- turtle.suck()
- turtle.suckUp()
- if turtle.detectUp() then
- DigAndCollect("u")
- end
- if turtle.detect() then
- DigAndCollect("f")
- end
- turtle.forward()
- if not turtle.detectDown() then
- pcall(turtle.placeDown)
- end
- for i = 1, math.huge do
- local Success, Result = pcall(turtle.getItemDetail, i)
- if not Success then
- break;
- end
- if Result and Result.name ~= "minecraft:coal" then
- turtle.select(i)
- turtle.dropUp(64)
- elseif Result and Result.name == "minecraft:coal" then
- turtle.select(i)
- turtle.refuel()
- end
- end
- Distance = Distance + 1
- print("Block #" .. tostring(Distance))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement