ComputerCraft Archive

fellTree

turtle mining Trinitek github

Description

Expected starting position is 1 block away from bottom left corner of 2x2 spruce.

Installation

Copy one of these commands into your ComputerCraft terminal:

wget:wget https://raw.githubusercontent.com/Trinitek/ComputerCraftScripts/master/scripts/fellTree.lua felltree
Archive:wget https://cc.shobie.xyz/cc/get/gh-Trinitek-ComputerCraftScripts-scripts-felltree felltree
Quick Install: wget https://cc.shobie.xyz/cc/get/gh-Trinitek-ComputerCraftScripts-scripts-felltree fellTree

Usage

Run: fellTree

Tags

turtlemining

Source

View Original Source

Code Preview


-- Expected starting position is 1 block away from bottom left corner of 2x2 spruce.

---@type integer
local height = 0

-- Just in case leaves generated right in front of the turtle
turtle.dig()
turtle.suck()

turtle.forward()
turtle.dig()
turtle.suck()
turtle.forward()

repeat
    turtle.dig()
    turtle.suck()
    turtle.forward()

    turtle.turnRight()

    turtle.dig()
    turtle.suck()
    turtle.forward()

    turtle.turnRight()

    turtle.dig()
    turtle.suck()
    turtle.forward()

    turtle.turnRight()
    
    turtle.forward()
    
    turtle.turnRight()

    local hasBlockAbove = turtle.digUp()

    if hasBlockAbove then
        turtle.suck()
        turtle.up()
        height = height + 1
    end
until not hasBlockAbove

for i = height, 1, -1 do
    turtle.digDown()
    turtle.suckDown()
    turtle.down()
end

turtle.back()
turtle.back()

print("Height " .. height)