Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.unloadAPI("/miner/movement")
- os.loadAPI("/miner/movement")
- local length
- local torchPlacementInterval=7
- local maxRetryCount=20
- function returnAfterRetryFailed()
- movement.move(0, 0, 0)
- movement.face("NORTH")
- write("\Move retry count reached!\n")
- print("Did you reach bedrock?")
- error()
- end
- function mineBlockAndMoveForward()
- local retryCount=0
- while movement.forward()==false do
- if retryCount>=maxRetryCount then
- returnAfterRetryFailed()
- end
- if turtle.dig()==false then
- turtle.attack()
- end
- retryCount=retryCount+1
- end
- end
- function placeTorch()
- turtle.select(1)
- if turtle.placeDown()==false then
- movement.down()
- turtle.select(2)
- turtle.placeDown()
- movement.up()
- turtle.select(1)
- turtle.placeDown()
- end
- end
- function digDown()
- if turtle.detectDown() then
- turtle.digDown()
- sleep(0.200)
- end
- end
- function branchmine(length)
- movement.up()
- for i=1,length do
- mineBlockAndMoveForward()
- digDown()
- if i==1 or (i%torchPlacementInterval)==0 then
- placeTorch()
- end
- end
- movement.move(0, 0, 1)
- movement.face("NORTH")
- movement.move(0, 0, 0)
- end
- local args={...}
- if #args >= 1 then
- length=tonumber(args[1])
- branchmine(length)
- else
- print("branchmine [length]")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement