local function clear()
term.clear()
term.setCursorPos(1,1)
end
local height = 0
i = 4
local function otherTrees()
if turtle.detectUp() then
turtle.digUp()
end
while turtle.detect() do
turtle.dig()
turtle.up()
if turtle.detectUp() then
turtle.digUp()
end
height = height + 1
end
end
local function jungleTree()
while placement == true do
turtle.dig()
turtle.forward()
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.digUp()
turtle.up()
turtle.turnRight()
height = height + 1
if turtle.detectUp() then
i = i
else
i = i - 1
end
if i == 0 then
placement = false
end
end
end
placement = false
clear()
print( "Which kind of tree am I looking at? (type the number of the tree)" )
print("1>Oak" )
print("2>Birch" )
print("3>Spruce" )
print("4>Jungle" )
tree = io.read()
tree = tonumber( tree )
sleep(.3)
clear()
if tree == 4 then
print("Felling a Jungle Tree")
turtle.dig()
turtle.forward()
turtle.turnLeft()
if turtle.detect() then
placement = true
else
turtle.turnRight()
placement = true
end
while placement == true do
jungleTree()
if i == 0 then
placement = false
end
end
elseif tree == 1 or tree == 2 or tree == 3 then
print("Lumberjack mode activated...")
otherTrees()
else
print("Not a valid option")
end
print( "Tree was "..height.." blocks tall" )
while height > 0 do
turtle.down()
height = height - 1
end