Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Ensure the turtle has a tool (diamond pickaxe) to dig stone
- if not turtle.dig() then
- print("Unable to dig. Do I have the correct tool?")
- end
- function mineLayer(x, y, z)
- if z < 1 then
- return
- else
- -- Dig down
- if turtle.detectDown() then
- if turtle.digDown() then
- print("Dug down.")
- else
- print("Failed to dig down. Is there a bedrock?")
- end
- end
- if turtle.down() then
- print("Moved down.")
- else
- print("Failed to move down.")
- end
- -- Call the function to mine the next layer
- mineLayer(x, y, z - 1)
- -- Dig up and return to original position
- if turtle.detectUp() then
- if turtle.digUp() then
- print("Dug up.")
- else
- print("Failed to dig up. Is there a bedrock?")
- end
- end
- if turtle.up() then
- print("Moved up.")
- else
- print("Failed to move up.")
- end
- end
- end
- function mineStrip(length)
- for i = 1, length do
- if turtle.detect() then
- if turtle.dig() then
- print("Dug forward.")
- else
- print("Failed to dig forward.")
- end
- end
- if turtle.forward() then
- print("Moved forward.")
- else
- print("Failed to move forward.")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement