CCCPaste

Test Charcoal Tree Farm

local function turn_around()
    turtle.turnLeft()
    turtle.turnLeft()
end

local function forward(times)
    for i = 1, times do
        turtle.forward()
    end
end

local function back(times)
    for i = 1, times do
        turtle.back()
    end
end

local function up(times)
    for i = 1, times do
        turtle.up()
    end
end

local function down(times)
    for i = 1, times do
        turtle.down()
    end
end

local function place_charcoal()
    for i = 1, 14 do
        local itDetail = turtle.getItemDetail(i)
        if itDetail and itDetail.name == 'minecraft:charcoal' then
            turtle.select(i)
            turtle.drop()
        end
    end
end

function create_charcoal()
    -- pace wood into furnace
    up(2)
    turtle.forward()
    for i = 1, 14 do
        local itDetail = turtle.getItemDetail(i)
        if itDetail and itDetail.name == 'minecraft:dark_oak_log' then
            turtle.select(i)
            turtle.dropDown()
        end
    end
    turtle.back()
    down(2)
    turtle.forward()
    turtle.suckUp()
    turtle.turnLeft()
    turtle.back()
    turtle.up()
    place_charcoal()
    turtle.down()
    turn_around()
    place_charcoal()

    -- place haul into chest
    turn_around()
    turtle.forward()
    for i = 1, 14 do
        turtle.select(i)
        turtle.drop()
    end
    turtle.turnLeft()
end

create_charcoal()