Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. function HarvestTree()
  2.     turtle.dig()
  3.     turtle.forward()
  4.     local treeHeight = 0
  5.     repeat
  6.         local success, data = turtle.inspectUp()
  7.         --Dig up until there is nothing above the turtle
  8.         if success then
  9.             turtle.digUp()
  10.             turtle.up()
  11.             treeHeight = treeHeight + 1
  12.         end
  13.     until(turtle.inspectUp() == false)
  14.     --Go back down to the stump
  15.     for i = 0, treeHeight do
  16.         turtle.digDown()
  17.         turtle.down()
  18.     end
  19.     turtle.back()
  20.     turtle.select(1)
  21.     turtle.place()
  22.     --Done harvesting
  23.     print("Harvested Tree with height of", treeHeight)
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement