chopStraight.lua

                Never    
Lua
       
-- sap(1) wood(2) leaves(3) chest(4)
function detectLeaves()
turtle.select(3)
return turtle.compare()
end

function detectWood()
turtle.select(2)
return turtle.compare()
end

function detectChest()
turtle.select(4)
return turtle.compare()
end

function detectWoodDown()
turtle.select(2)
return turtle.compareDown()
end

function emptyOut6to16()
    for slot=6,16 do
    turtle.select(slot)
    turtle.drop()
    end
end

function chopTree()
turtle.dig()
turtle.forward()
--local height = 0
    while turtle.compareUp() do
    turtle.digUp()
    turtle.up()
    end
    
   -- while detectDirt() do
    --turtle.down()
    --end
end

function plantTree()
turtle.select(1)
--turtle.up()
turtle.placeDown()
end

function detectSapling()
turtle.select(1)
return turtle.compare()
end
--start program
while turtle.getFuelLevel() > 1000 do
    if detectLeaves() then
        while detectLeaves() do
        turtle.dig()
        turtle.forward()
        end
    else if detectWood() then
    chopTree()
        while not (detectWoodDown()) do
           -- if turtle.detectDown() then
            --turtle.digDown()
           -- end
            
         turtle.down()
        
        end
    turtle.digDown()
    plantTree()
    else if detectChest() then
    emptyOut6to16()
    turtle.turnLeft()
    turtle.turnLeft()
    sleep(240)
    else
    turtle.forward()
    end
end
end
end

Raw Text