block, typ = turtle.inspect()
-- Cut down the tree
function rodung()
turtle.dig()
turtle.forward()
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
while not turtle.detectDown() do
turtle.down()
end
turtle.back()
end
--planting the sapling
function pflanzen()
turtle.select(16)
turtle.place()
turtle.select(1)
end
-- Warning to put saps in Slot 16
function hinweis()
print("Bitte Setzlinge in Slot 16")
end
hinweis()
while true do
-- compares the block in front with "minecraft:log"
if block == true then
for k,v in pairs(typ) do
-- if so, do cut the tree and plant again
if v == "minecraft:log" then
print("Baumstamm gewachsen")
rodung()
pflanzen()
else
-- print "no tree" and wait
print("Noch kein Baum")
os.sleep(10)
end
end
end
--wait again then clear screen
os.sleep(10)
term.clear()
term.setCursorPos(1, 1)
end