Advertisement
Aixler

Chop

Jan 26th, 2013
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  1. print("put an enderchest to the right of the tree")
  2. print("slot 12 = bonemeal")
  3. print("slot 13-16 = sapling")
  4. print("type in anything and press enter to start")
  5.  
  6. io.read()
  7.  
  8. height = 0
  9.  
  10. function plant()
  11.  
  12.     slot = 13
  13.     turtle.select(slot)
  14.     while not turtle.place() do
  15.         if slot > 17 then
  16.             error()
  17.         end
  18.         turtle.select(slot)
  19.         slot = slot + 1
  20.     end
  21. end
  22.  
  23. function grow()
  24.     plant()
  25.     turtle.back()
  26.     plant()
  27.     turtle.turnLeft()
  28.     turtle.forward()
  29.     turtle.turnRight()
  30.     turtle.forward()
  31.     plant()
  32.     turtle.back()
  33.     plant()
  34.     turtle.select(12)
  35.     turtle.place()
  36.     turtle.select(1)
  37. end
  38.  
  39. function chop()
  40.     turtle.dig()
  41.     turtle.forward()
  42.     while turtle.digUp() do
  43.         turtle.dig()
  44.         turtle.up()
  45.         height = height + 1
  46.     end
  47.     turtle.dig()
  48.     turtle.turnRight()
  49.     turtle.dig()
  50.     turtle.forward()
  51.     turtle.turnLeft()
  52.     for x=1, height do
  53.         turtle.dig()
  54.         turtle.digDown()
  55.         turtle.down()
  56.     end
  57.     turtle.dig()
  58.     print("This tree was ".. height .." blocks tall!")
  59.     height = 0
  60. end
  61.  
  62. function dropOff()
  63.     turtle.turnRight()
  64.     slot = 1
  65.     for x=1, 11 do
  66.         turtle.select(slot)
  67.         turtle.drop()
  68.         slot = slot + 1
  69.     end
  70.     slot = 1
  71.     turtle.turnLeft()
  72. end
  73.  
  74. function sleeping()
  75.     nap = 12
  76.     for x=1, 11 do
  77.         if nap < 10 then
  78.             print("Waking up in  ".. nap .."min")
  79.             sleep(60)
  80.             nap = nap - 1  
  81.         else
  82.             print("Waking up in ".. nap .."min")
  83.             sleep(60)
  84.             nap = nap - 1
  85.         end
  86.     end
  87.     print("Time to get to work!")
  88. end
  89.  
  90. while turtle.getItemCount(12) > 0 and (turtle.getItemCount(13) + turtle.getItemCount(14) + turtle.getItemCount(15) + turtle.getItemCount(16)) > 3 and turtle.getFuelLevel() > 150 do
  91.     grow()
  92.     chop()
  93.     dropOff()
  94.     sleeping()
  95. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement