Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local facing = true
- function is_at_bedrock()
- local block_exists, block_data = turtle.inspectDown()
- if block_exists and block_data.name == 'minecraft:bedrock' then
- return true
- else
- return false
- end
- end
- function is_facing_bedrock()
- local block_exists, block_data = turtle.inspect()
- if block_exists and block_data.name == 'minecraft:bedrock' then
- return true
- else
- return false
- end
- end
- function refuel_and_move()
- if turtle.getFuelLevel() <= 0 and not turtle.refuel() then
- print('Out of fuel! :(')
- return false
- else
- return turtle.forward()
- end
- end
- while true do
- for i=0,15 do
- for j=0,15 do
- if is_at_bedrock() then
- return
- end
- turtle.digDown()
- if is_facing_bedrock() then
- return
- end
- turtle.dig()
- if not refuel_and_move() then
- return
- end
- end
- if i==15 and j==15 then
- turtle.turnRight()
- turtle.turnRight()
- facing = false
- elseif facing then
- turtle.turnRight()
- if is_facing_bedrock() then
- return
- else
- turtle.dig()
- end
- if not refuel_and_move() then
- return
- end
- turtle.turnRight()
- else
- turtle.turnLeft()
- if is_facing_bedrock() then
- return
- else
- turtle.dig()
- end
- if not refuel_and_move() then
- return
- end
- turtle.turnLeft()
- end
- facing = not facing
- end
- turtle.down()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement