Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- delay=0.05
- while(true) do
- local success, ydata = turtle.inspect()
- if not success then
- ydata = {name=""}
- end
- while not (string.find(ydata.name,"sapling")==nil) do
- turtle.suck()
- success, ydata = turtle.inspect()
- if not success then
- ydata = {name=""}
- end
- end
- print("digging")
- while not turtle.forward() do
- turtle.dig()
- turtle.attack()
- print("sleep")
- sleep(delay)
- end
- print("moved forward")
- success, ydata = turtle.inspectUp()
- if not success then
- ydata = {name=""}
- end
- while not (string.find(ydata.name,"log")==nil) do
- while not turtle.up() do
- turtle.digUp()
- sleep(delay)
- end
- success, ydata = turtle.inspectUp()
- if not success then
- ydata = {name=""}
- end
- end
- print("mined oak")
- while not turtle.detectDown() do
- turtle.down()
- end
- print("moved down")
- turtle.back()
- saplingcount=0
- for i=1,16 do
- if turtle.getItemCount(i) > 0 then
- item=turtle.getItemDetail(i).name
- print(item)
- if not (string.find(item,"sapling")==nil) then
- if saplingcount>60 then
- turtle.select(i)
- while turtle.dropDown() == false and turtle.getItemCount() ~= 0 do -- Waits until turtle can deposit item
- sleep(1)
- end
- else
- saplingcount=saplingcount+turtle.getItemCount(i)
- turtle.select(i)
- turtle.transferTo(1)
- end
- else
- turtle.select(i)
- while turtle.dropDown() == false and turtle.getItemCount() ~= 0 do -- Waits until turtle can deposit item
- sleep(1)
- end
- end
- end
- end
- turtle.select(1)
- turtle.place()
- end
Advertisement
Add Comment
Please, Sign In to add comment