Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tPos = 0
- tLength = 250
- function turnAbout()
- turtle.turnRight()
- turtle.turnRight()
- end
- function findOrigin()
- turnAbout()
- while tPos > 0 do
- turtle.forward()
- tPos = tPos - 1
- end
- turnAbout()
- end
- function tryDig()
- while turtle.inspect() do
- if not turtle.dig() then
- turtle.select(getItem("minecraft:cobblestone"))
- turtle.place()
- turtle.dig()
- break
- end
- os.sleep(0.3)
- end
- end
- function getItem(item)
- for i= 1, 16 do
- local data = turtle.getItemDetail(i)
- if data then
- if data.name == item then
- if turtle.getItemCount(i) > 0 then
- return i
- end
- end
- end
- end
- return 1
- end
- function checkTunnel(digStage)
- turtle.select(getItem("minecraft:cobblestone"))
- if digStage == 0 then
- if not turtle.detectDown() then
- turtle.placeDown()
- end
- turtle.turnLeft()
- if not turtle.detect() then
- turtle.place()
- end
- turtle.turnRight()
- elseif digStage == 1 then
- if not turtle.detectUp() then
- turtle.placeUp()
- end
- turtle.turnLeft()
- if not turtle.detect() then
- turtle.place()
- end
- turtle.turnRight()
- elseif digStage == 2 then
- if not turtle.detectUp() then
- turtle.placeUp()
- end
- turtle.turnRight()
- if not turtle.detect() then
- turtle.place()
- end
- turtle.turnLeft()
- elseif digStage == 3 then
- turtle.turnRight()
- if not turtle.detect() then
- turtle.place()
- end
- turtle.turnLeft()
- if not turtle.detectDown() then
- turtle.placeDown()
- end
- end
- end
- function moveForward()
- if not turtle.forward() then
- tryDig()
- turtle.forward()
- end
- end
- while tPos < tLength do
- if turtle.getFuelLevel() < 10 then
- turtle.select(getItem("minecraft:coal"))
- turtle.refuel()
- end
- tryDig()
- checkTunnel(0)
- turtle.up()
- tryDig()
- checkTunnel(1)
- turtle.turnRight()
- moveForward()
- turtle.turnLeft()
- tryDig()
- checkTunnel(2)
- turtle.down()
- tryDig()
- checkTunnel(3)
- turtle.turnLeft()
- moveForward()
- turtle.turnRight()
- moveForward()
- tPos = tPos + 1
- if tPos % 5 == 0 then
- turtle.turnLeft()
- tryDig()
- turtle.select(getItem("minecraft:torch"))
- turtle.place()
- turtle.turnRight()
- end
- end
- findOrigin()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement