Advertisement
Shaka01

botania wood/stone farm

Oct 1st, 2016 (edited)
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.61 KB | None | 0 0
  1. -- -- --
  2. --  d --
  3. -- -- --
  4.  
  5. --turtle on bottom left corner, chest with ingredients above, chest to dump items to the left below, turtle direction ^
  6.  
  7.  
  8. moves = 0
  9. go = "n"
  10. turtle.select(1)
  11.  
  12. function replace()
  13. turtle.digDown()
  14. turtle.placeDown()
  15. end
  16.  
  17. function checkslot()
  18. if turtle.getItemCount(1) > 0 then
  19.     data = turtle.getItemDetail(1)
  20.     if data.name == "minecraft:stone" then
  21.         go = "y"
  22.     end
  23.     if data.name == "minecraft:spruce_log" then
  24.         go = "y"
  25.     end
  26. else
  27.         repeat
  28.         turtle.getItemCount(1)
  29.             print("Need stone or wood plx.")
  30.             sleep(5)
  31.         until turtle.getItemCount(1) > 0
  32. end
  33. end
  34.  
  35. function checkformats()
  36. checkslot()
  37.     if go ~= "y" then
  38.         repeat
  39.             checkslot()
  40.             print("Need stone or wood plx.")
  41.             sleep(5)
  42.         until go == "y"
  43.     end
  44. go = "n"   
  45. end
  46.  
  47. function move()
  48.     repeat
  49.     checkformats()
  50.     replace()
  51.     if turtle.forward() then moves = moves + 1 end
  52.     until moves == 2
  53. end
  54.  
  55.  
  56. function oneround()
  57. for i =1, 4 do
  58.     move()
  59.     turtle.turnRight()
  60.     moves = 0
  61. end
  62. end
  63.  
  64. function unloaditems()
  65.     for i=2, 16 do
  66.         if turtle.getItemCount(i) > 0 then
  67.             turtle.select(i)
  68.             if turtle.dropDown() == false then
  69.                 sleep(5)
  70.                 print("Waiting for storage")
  71.             end
  72.         end
  73.     end
  74.     turtle.select(1)
  75. end
  76.  
  77.  
  78. while true do
  79. oneround()
  80. turtle.turnLeft()
  81. repeat until turtle.forward()
  82. unloaditems()
  83. repeat until turtle.back()
  84. turtle.turnRight()
  85. if turtle.suckUp() == false then
  86. repeat
  87. print("Barrel empty, plz refill.")
  88. sleep(5)
  89. until turtle.suckUp()
  90. end
  91. for i = 2, 16 do
  92.     if turtle.getItemCount(i) > 0 then
  93.     turtle.select(i)
  94.     turtle.dropUp()
  95.     end
  96. turtle.select(1)
  97. end
  98. sleep(50)
  99. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement