Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

local saplings = 1 -- the slot where the saplings are

turtle.select(saplings) -- selects saplings


while turtle.getItemCount(saplings) > 0 do
for i = 1, 8 do -- plants 8 saplings
turtle.turnRight()
if not turtle.compare() then -- if not a sapling, a tree grew?
turtle.dig()
turtle.forward()
while turtle.detectUp() do -- digs the tree out
turtle.digUp()
turtle.up()
end
while not turtle.detectDown() do -- back down to ground
turtle.down()
end
turtle.back()
turtle.place()
end
turtle.turnLeft()
turtle.forward()
end
-- turn around and line up for next pass
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
os.sleep(10) -- sleep for 10 seconds to allow trees to grow
end

You might also like