Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cords = {}
- cords["X"] = {}
- cords["X"] = 0
- cords["Y"] = {}
- cords["Y"] = 0
- sessioncount = 0
- function checkFuel()
- while range()>turtle.getFuelLevel() do
- for C = 1,16 do
- G = turtle.getItemDetail(C)
- if G["name"] == "minecraft:coal" then
- turtle.refuel(G["count"])
- end
- end
- end
- end
- function range()
- return cords["X"] + cords["Y"]
- end
- function mine()
- turtle.dig()
- turtle.digUp()
- turtle.up()
- checkFuel()
- turtle.dig()
- turtle.digUp()
- turtle.up()
- checkFuel()
- turtle.dig()
- checkFuel()
- turtle.digDown()
- turtle.down()
- checkFuel()
- turtle.digDown()
- turtle.down()
- checkFuel()
- turtle.turnLeft()
- turtle.dig()
- turtle.digUp()
- turtle.up()
- checkFuel()
- turtle.dig()
- turtle.digUp()
- turtle.up()
- checkFuel()
- turtle.dig()
- checkFuel()
- turtle.digDown()
- turtle.down()
- checkFuel()
- turtle.digDown()
- turtle.down()
- checkFuel()
- turtle.turnRight()
- turtle.turnRight()
- turtle.dig()
- turtle.digUp()
- turtle.up()
- checkFuel()
- turtle.dig()
- turtle.digUp()
- turtle.up()
- checkFuel()
- turtle.dig()
- checkFuel()
- turtle.digDown()
- turtle.down()
- checkFuel()
- turtle.digDown()
- turtle.down()
- checkFuel()
- forward()
- forward()
- forward()
- go()
- else
- forward()
- go()
- end
- end
- end
- function updateCords(x,y)
- cords["X"] = x + cords["X"]
- cords["Y"] = y + cords["Y"]
- end
- function goHome()
- if cords["X"] < 0 then
- turtle.turnRight()
- elseif cords["X"] == 0 then
- else
- turtle.turnLeft()
- end
- dist = math.abs(cords["X"])
- for X = 1, dist do
- turtle.dig()
- turtle.forward()
- end
- if cords["Y"] < 0 then
- ydist = math.abs(cords["Y"])
- turtle.turnLeft()
- turtle.turnLeft()
- for Y = 1,ydist do
- turtle.dig()
- turtle.forward()
- end
- else
- ydist = math.abs(cords["Y"])
- for Y = 1,ydist do
- turtle.dig()
- turtle.forward()
- end
- end
- end
- function go()
- mine()
- sessioncount = sessioncount + 1
- forward()
- end
- function forward()
- if sessioncount <= 100 then
- turtle.forward()
- go()
- else
- goHome()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement