resaloli

Turtle Tree BoP

Mar 26th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. size = 0
  2. turtle.select(16)
  3. turtle.place()
  4. function moreSaplings()
  5.     if turtle.getItemCount(16) < 1 then
  6.         while turtle.getItemCount(16) < 1 do
  7.             sleep(1)
  8.             print("Waiting for Saplings")
  9.         end
  10.         print("Got Saplings")
  11.         turtle.select(16)
  12.         turtle.place()
  13.     else
  14.         print("Still got "..turtle.getItemCount(16).." Saplings")
  15.     end
  16. end
  17.  
  18. function refuel()
  19.     if turtle.getFuelLevel() < 64 then
  20.         while turtle.getItemCount(15) < 1 do
  21.             sleep(1)
  22.             print("Waiting for Fuel")
  23.         end
  24.         turtle.select(14)
  25.         turtle.refuel()
  26.         turtle.select(1)
  27.         print("Done Refuelling")
  28.     end
  29. end
  30.  
  31. function detect()
  32.     local sucess, info = turtle.inspect()
  33.     if info.name == "BiomesOPlenty:logs1" and info.metadata == 3 then
  34.         main()
  35.     else
  36.         print("Didn't Grow")
  37.     end
  38. end
  39.  
  40.  
  41. function main()
  42.     turtle.dig()
  43.     turtle.forward()
  44.     while turtle.detectUp() do
  45.         turtle.digUp()
  46.         turtle.up()
  47.         size = size + 1
  48.     end
  49.     for i = 0, size do
  50.         turtle.down()
  51.     end
  52.     size = 0
  53.     turtle.back()
  54.     turtle.select(16)
  55.     turtle.place()
  56.     for i = 1, 14 do
  57.         turtle.select(i)
  58.         turtle.dropDown()
  59.     end
  60. end
  61.  
  62. while true do
  63.     detect()
  64.     refuel()
  65.     moreSaplings()
  66.     sleep(5)
  67. end
Add Comment
Please, Sign In to add comment