Advertisement
natie3

Tree

Oct 10th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. os.loadAPI("moveAPI")
  2.  
  3. function tree()
  4.   moveAPI.move("f dd")
  5.   turtle.placeDown()
  6.   while turtle.detectUp() do
  7.     moveAPI.move("u")
  8.   end
  9.   while not turtle.detectDown() do
  10.     moveAPI.move("d")
  11.   end
  12. end
  13.  
  14. function row()
  15.   for i = 1, 4 do
  16.     if turtle.detect() then
  17.       tree()
  18.     else
  19.       turtle.forward()
  20.     end
  21.     if i ~= 4 then
  22.       moveAPI.move("f f f")
  23.    end
  24.   end
  25.   moveAPI.move("f")
  26. end
  27.  
  28. function main()
  29.   moveAPI.move("u u u r f f f f f f l f f f")
  30.   turtle.turnLeft()
  31.   row()
  32.   moveAPI.move("r f f f")
  33.   turtle.turnRight()
  34.   row()
  35.   moveAPI.move("l f f f")
  36.   turtle.turnLeft()
  37.   row()
  38.   turtle.turnLeft()
  39.   moveAPI.repeatMoves("f", 12)
  40.   moveAPI.move("l f f f f f f d d d")
  41.   turtle.turnLeft()
  42.   for i = 2, 16 do
  43.     turtle.select(i)
  44.     turtle.dropDown()
  45.   end
  46.   turtle.select(1)
  47. end
  48.  
  49. turtle.select(1)
  50. itemDetail = turtle.getItemDetail()
  51. if itemDetail ~= nil and itemDetail.count >= 12 and itemDetail.name == "minecraft:sapling" then
  52.   main()
  53. else
  54.   error("put at least 12 saplings in slot 1")
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement