Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = { ... }
- local loopCount = 1
- if #args ~= 1 then
- print( "Requires length of tunnel" )
- error()
- end
- data = turtle.getItemDetail()
- if not data then
- print( "Requires torches in current slot" )
- error()
- end
- if data then
- if data.name ~= "minecraft:torch" then
- print( "Requires torches in current slot" )
- error()
- end
- end
- print("Here we go!")
- local deepTimes = tonumber(args[1])
- local function checkIfDiamond()
- success, data = turtle.inspect()
- if success then
- if data.name == "minecraft:diamond_ore" then
- print( "Found diamond")
- error()
- end
- end
- success, data = turtle.inspectUp()
- if success then
- if data.name == "minecraft:diamond_ore" then
- print( "Found diamond")
- error()
- end
- end
- success, data = turtle.inspectDown()
- if success then
- if data.name == "minecraft:diamond_ore" then
- print( "Found diamond")
- error()
- end
- end
- end
- local function forwardLoop(loopAmount)
- for i=1,loopAmount do
- checkIfDiamond()
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- if (i % 10 == 0) and (loopCount == 2) then
- turtle.placeDown()
- end
- turtle.forward()
- end
- loopCount = loopCount + 1
- end
- local function turnLeft()
- turtle.turnLeft()
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- turtle.forward()
- turtle.turnLeft()
- end
- local function turnRight()
- turtle.turnRight()
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- turtle.forward()
- turtle.turnRight()
- end
- forwardLoop(deepTimes)
- turnLeft()
- forwardLoop(deepTimes)
- turnRight()
- forwardLoop(deepTimes)
- print("Fin")
Add Comment
Please, Sign In to add comment