Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function refuel()
- if turtle.getFuelLevel() < 10 then
- turtle.select(1)
- turtle.refuel(1)
- end
- end
- retrace = {}
- while true do
- refuel()
- a, b = turtle.inspect()
- if a and b.name == "minecraft:coal_ore" then
- turtle.dig()
- turtle.forward()
- table.insert(retrace, "back")
- else
- a, b = turtle.inspectUp()
- if a and b.name == "minecraft:coal_ore" then
- turtle.digUp()
- turtle.up()
- table.insert(retrace, "down")
- else
- a, b = turtle.inspectDown()
- if a and b.name == "minecraft:coal_ore" then
- turtle.digDown()
- turtle.down()
- table.insert(retrace, "up")
- else
- turtle.turnLeft()
- a, b = turtle.inspect()
- if a and b.name == "minecraft:coal_ore" then
- turtle.dig()
- turtle.forward()
- table.insert(retrace, "right")
- table.insert(retrace, "back")
- else
- turtle.turnRight()
- turtle.turnRight()
- a, b = turtle.inspect()
- if a and b.name == "minecraft:coal_ore" then
- turtle.dig()
- turtle.forward()
- table.insert(retrace, "left")
- table.insert(retrace, "back")
- else
- turtle.turnRight()
- a, b = turtle.inspect()
- if a and b.name == "minecraft:coal_ore" then
- turtle.dig()
- turtle.forward()
- table.insert(retrace, "right")
- table.insert(retrace, "back")
- else
- turtle.turnRight()
- break
- end
- end
- end
- end
- end
- end
- end
- for i, command in ipairs(retrace) do
- if command == "forward" then
- turtle.forward()
- end
- if command == "back" then
- turtle.back()
- end
- if command == "right" then
- turtle.turnRight()
- end
- if command == "left" then
- turtle.turnLeft()
- end
- if command == "up" then
- turtle.up()
- end
- if command == "forward" then
- turtle.down()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement