Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("tAPIs")
- local depth = 0
- local treasure = {"minecraft:iron_ore" = true,"minecraft:coal_ore" = true,"minecraft:gold_ore" = true,"minecraft:diamond_ore" = true}
- local function junk() --defines function
- local found, block = turtle.inspect()
- if found and treasure[block.name] then
- turtle.dig()
- end
- end
- local function walls()
- for w = 1,4 do
- turtle.select(1)
- turtle.inspect()
- junk()
- turtle.turnLeft()
- 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
Advertisement