Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("tAPIs") --loads fuel function
- local depth = 0 --sets variable to return back to surface
- function junk() --defines function
- if turtle.inspect() == "minecraft:iron_ore" then --determines if item is valuable
- turtle.dig()
- end
- end
- function walls() --checks all four walls and determines if anything is worth mining
- for w = 1,4 do --runs four times
- turtle.select(1) --selects first slot
- turtle.inspect() --compares front object to first slot
- junk()
- turtle.turnLeft() --turns left for next wall
- end
- end
- tAPIs.fuel() --refuels
- turtle.digDown() --digs down so that detect doesnt return true
- for d = 1,2 do --digs down two blocks
- turtle.down()
- turtle.digDown()
- depth = depth-1 --records depth
- end
- turtle.detectDown() --detects if block is under turtle
- while turtle.detectDown() ~= true do --if nothing under turtle then this runs
- turtle.down()
- depth = depth-1
- walls()
- turtle.digDown()
- turtle.detectDown()
- end
- if turtle.detectDown() == true then --when turtle encounters bedrock or air, needs to be fixed for caves
- tAPIs.fuel()
- while depth < 0 do --loop to return to surface or starting position
- turtle.up()
- depth = depth+1 --records depth
- end
- end
- if depth == 0 then --when turtle reaches starting position place down a block and stop moving
- turtle.select(2)
- turtle.placeDown()
- error()
- end
Advertisement
Add Comment
Please, Sign In to add comment