Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local counter = 0
- local log_counter = 0
- function getTree()
- local goUp = 0
- local success, t = turtle.inspect()
- if success then
- if (string.find(t.name, "leaves") == nil) then
- if string.find(t.name, "rubberwood.log") then
- turtle.dig()
- if turtle.forward() == false then
- turtle.dig()
- turtle.forward()
- else
- if turtle.detectUp() == true then
- while (turtle.detectUp()) do
- local success, t = turtle.inspectUp()
- if (string.find(t.name, "leaves") == nil) then
- turtle.digUp()
- log_counter = log_counter + 1
- turtle.up()
- goUp = goUp + 1
- else
- break
- end
- end
- if goUp > 0 then
- repeat
- turtle.down()
- goUp = goUp - 1
- until goUp == 0
- end
- else
- if goUp > 0 then
- repeat
- turtle.down()
- goUp = goUp - 1
- until goUp == 0
- end
- end
- turtle.up()
- turtle.select(1)
- turtle.placeDown()
- turtle.back()
- turtle.down()
- if turtle.getItemCount(1) > 1 then
- if string.find(turtle.getItemDetail(1).name, "sapling") then
- turtle.placeDown()
- end
- end
- goBack()
- end
- end
- end
- end
- end
- function goBack()
- counter = counter + 1
- print("Tree's done: " .. counter .. " | Logs gotten:" .. log_counter)
- end
- while true do
- getTree()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement