Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - --According to Benjamin Buford "Bubba" Blue I should make notes.
 - -- aLenght is the Actual length of the branch mine. length is an argument. done indicates whether or not the branch mine is finished
 - local arg = { ... }
 - local length = tonumber(arg[1])
 - local aLength = 0
 - local nBranch = 0
 - --Checks if the arguments are valid.
 - if length == nil then
 - print [[Please only use numbers.
 - Usage: branch <length>]]
 - return false
 - elseif length < 1 then
 - print [[Please only use positive numbers.
 - Usage: branch <length>]]
 - return false
 - end
 - --Source for function refuel(): tunnel, a standard CC mining turtle program. All credit goes to the original author.
 - --It refuels :O
 - local function refuel()
 - local fuelLevel = turtle.getFuelLevel()
 - if fuelLevel == "unlimited" or fuelLevel > 0 then
 - return
 - end
 - local function tryRefuel()
 - for n=1,16 do
 - if turtle.getItemCount(n) > 0 then
 - turtle.select(n)
 - if turtle.refuel(1) then
 - turtle.select(1)
 - return true
 - end
 - end
 - end
 - turtle.select(1)
 - return false
 - end
 - if not tryRefuel() then
 - print( "Add more fuel to continue." )
 - while not tryRefuel() do
 - sleep(1)
 - end
 - print( "Resuming Tunnel." )
 - end
 - end
 - --Digs forward.
 - local function frontDig()
 - while turtle.detect() do
 - turtle.dig()
 - sleep(0.25)
 - end
 - end
 - --Digs up.
 - local function upDig()
 - while turtle.detectUp() do
 - turtle.digUp()
 - sleep(0.25)
 - end
 - end
 - --Digs down.
 - local function downDig()
 - while turtle.detectDown() do
 - turtle.digDown()
 - sleep(0.25)
 - end
 - end
 - --Goes forward.
 - local function frontGo()
 - refuel()
 - frontDig()
 - while turtle.attack() do
 - turtle.attack()
 - sleep(0.25)
 - end
 - turtle.forward()
 - end
 - --Goes up.
 - local function upGo()
 - refuel()
 - upDig()
 - while turtle.attackUp() do
 - turtle.attackUp()
 - sleep(0.25)
 - end
 - turtle.up()
 - end
 - --Goes down.
 - local function downGo()
 - refuel()
 - downDig()
 - while turtle.attackDown() do
 - turtle.attackDown()
 - sleep(0.25)
 - end
 - turtle.down()
 - end
 - --Makes trunk.
 - local function trunkMine()
 - upDig()
 - turtle.turnLeft()
 - frontDig()
 - upGo()
 - frontDig()
 - downGo()
 - turtle.turnRight()
 - aLength = aLength + 1
 - if aLength % 25 == 0 then
 - print( "The branch mine is now " , aLength , " blocks long." )
 - end
 - end
 - --Makes branch.
 - local function branchMine()
 - local function branch()
 - for n=1,5 do
 - frontGo()
 - upDig()
 - end
 - end
 - local function move()
 - turtle.turnLeft()
 - turtle.turnLeft()
 - for n=1,6 do
 - frontGo()
 - upDig()
 - end
 - end
 - turtle.turnRight()
 - branch()
 - move()
 - branch()
 - move()
 - turtle.turnLeft()
 - end
 - --Mines the eventual branch mine.
 - local function treeMine()
 - for n=1,3 do
 - trunkMine()
 - if aLength == length then
 - print( [[Finished branch mine.
 - The branch mine is ]], aLength, " blocks long." )
 - return true
 - elseif n ~= 3 then
 - frontGo()
 - end
 - end
 - branchMine()
 - frontGo()
 - end
 - print( "Mining ", length, " blocks long branch mine." )
 - --Makes branch mine until desired length is achieved.
 - while aLength < length do
 - treeMine()
 - end
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment