Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- code featured in https://www.youtube.com/watch?v=EWN_mphyw9o
- function getSaplings()
- -- return true/false if saplings are dug
- for index = 1, 4 do
- turtle.dig()
- turtle.turnRight()
- end
- end
- function plantSapling()
- -- if sapling present plant it
- if turtle.getItemCount(2) > 0 then
- turtle.up()
- turtle.select(2)
- if turtle.placeDown() then
- print("Sapling placed")
- turtle.back()
- turtle.down()
- else
- print("If you are hungry, I have an apple")
- end
- end
- end
- function main()
- -- clear screen
- term.clear()
- term.setCursorPos(1,1)
- print("Press Esc key. Starting in 2 secs")
- os.sleep(2)
- -- select slot 1
- turtle.select(1)
- turtle.dig()
- turtle.craft()
- turtle.refuel()
- turtle.forward()
- --move up and cut the tree
- while turtle.detectUp() == true do
- turtle.digUp()
- turtle.up()
- getSaplings()
- end
- -- reached tree top
- while turtle.detectDown() == false do
- turtle.down()
- end
- plantSapling()
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement