Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. local function checkFuel()
  2. if turtle.getFuelLevel() < 100 then
  3. select(16)
  4. if turtle.getItemCount() >= 100 then
  5. for i=0,100 do
  6. turtle.refuel()
  7. end
  8. else
  9. textutils.slowPrint("Please refuel")
  10. end
  11. end
  12. end
  13.  
  14. local function checkStock()
  15. select(2)
  16. if turtle.getItemCount() == 0 then
  17. print("Not enough seeds")
  18. end
  19. end
  20.  
  21. local function farm()
  22. select(5)
  23. turtle.digDown()
  24. end
  25.  
  26. local function move()
  27. local success, data = turtle.inspectDown()
  28. if data.name != "minecraft:cobblestone_slab" then
  29. turtle.forward()
  30. else
  31. if dir==1 then
  32. turtle.turnLeft()
  33. turtle.forward()
  34. local success, data = turtle.inspectDown()
  35. if data.name != "minecraft:cobblestone_slab" then
  36. turtle.back()
  37. turtle.turnLeft()
  38. else
  39. turtle.turnLeft()
  40. turtle.forward()
  41. dir = 2
  42. end
  43. end
  44. if dir == 2 then
  45. turtle.turnRight()
  46. turtle.forward()
  47. local success, data = turtle.inspectDown()
  48. if data.name != "minecraft:cobblestone_slab" then
  49. turtle.back()
  50. turtle.turnRight()
  51. else
  52. turtle.turnRight()
  53. turtle.forward()
  54. dir = 1
  55. end
  56. end
  57. end
  58.  
  59. end
  60.  
  61. while true do
  62. checkFuel()
  63. checkStock()
  64. farm()
  65. move()
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement