Advertisement
JMANN2400

Tree Farm Feller

Jul 30th, 2017
551
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.47 KB | None | 0 0
  1.  
  2. n = 0
  3.  
  4. function mineUp()
  5.     turtle.dig()
  6.     turtle.digUp()
  7.     turtle.up()
  8. end
  9.  
  10. function mineTree()
  11.     mineUp()
  12.     mineUp()
  13.     mineUp()
  14.     mineUp()
  15.     mineUp()
  16.     mineUp()
  17.     mineUp()
  18.     mineUp()
  19.     mineUp()
  20.     mineUp()
  21.     turtle.down()
  22.     turtle.down()
  23.     turtle.down()
  24.     turtle.down()
  25.     turtle.down()
  26.     turtle.down()
  27.     turtle.down()
  28.     turtle.down()
  29.     turtle.down()
  30.     turtle.down()
  31. end
  32.  
  33. function checkTree()
  34.     turtle.turnLeft()
  35.     success, data = turtle.inspect()
  36.     if data.name == "minecraft:log" then
  37.         mineTree()
  38.     end
  39.     turtle.turnRight()
  40. end
  41.  
  42. function moveSix()
  43.     turtle.forward()
  44.     turtle.forward()
  45.     turtle.forward()
  46.     turtle.forward()
  47.     turtle.forward()
  48.     turtle.forward()
  49. end
  50.  
  51.  
  52.  
  53. print("+-------------------------------------+")
  54. print("| Auto Tree Farm Feller               |")
  55. print("+-------------------------------------+")
  56. print("| Slot 1: Fuel                        |")
  57. print("+-------------------------------------+")
  58. print("| Place turtle facing towards desired |")
  59. print("| direction on same level as tree to  |")
  60. print("| the right of the tree. Insert fuel. |")
  61. print("| Press enter to start.               |")
  62. print("+-------------------------------------+")
  63. print("| Trees to check = ?                  |")
  64. print("+-------------------------------------+")
  65. nc = tonumber(read())
  66. turtle.refuel()
  67. while nc > n do
  68.     checkTree()
  69.     moveSix()
  70.     n = n + 1
  71. end
  72. turtle.turnRight()
  73. turtle.turnRight()
  74. for a=1,nc,1 do
  75.     moveSix()
  76. end
  77. turtle.turnRight()
  78. turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement