Advertisement
NoobieDoobie

Untitled

Feb 26th, 2021
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. function Coal()
  2. if turtle.getFuelLevel() < 40 and turtle.getItemCount(1) <2 then
  3. print "Bitte Treibstoff in den 1. Slot geben"
  4. end
  5. end
  6.  
  7. function Refuel()
  8. if turtle.getFuelLevel() < 100 then
  9. turtle.select(1)
  10. turtle.refuel(turtle.getItemCount()-1)
  11. end
  12. end
  13.  
  14. x=0
  15. y=0
  16.  
  17. function Mv()
  18. Coal()
  19. Refuel()
  20. while not turtle.forward() do
  21. turtle.attack()
  22. end
  23. end
  24.  
  25. function Startup()
  26. while turtle.forward() do
  27. x=x+1
  28. end
  29. turtle.turnRight()
  30. while turtle.forward() do
  31. y=y+1
  32. end
  33. turtle.turnRight()
  34. for l=1, x, 1 do
  35. Mv()
  36. end
  37. turtle.turnRight()
  38. for m=1, y, 1 do
  39. Mv()
  40. end
  41. turtle.turnRight()
  42. end
  43.  
  44. function CheckBelow()
  45. success, data = turtle.inspectDown()
  46. if data.metadata == 7 then
  47. turtle.digDown()
  48. if data.name == "minecraft:carrots" then
  49. turtle.select(3)
  50. turtle.placeDown()
  51. elseif data.name == "minecraft:potatoes" then
  52. turtle.select(2)
  53. turtle.placeDown()
  54. end
  55. end
  56. end
  57.  
  58. function CheckField()
  59. for j=1, y, 1 do
  60. for k=1, x, 1 do
  61. CheckBelow()
  62. Mv()
  63. print("x:",k," von ",x)
  64. end
  65. CheckBelow()
  66. if j%2 == 1 and not(j==y) then
  67. turtle.turnRight()
  68. Mv()
  69. turtle.turnRight()
  70. elseif not(j==y) then
  71. turtle.turnLeft()
  72. Mv()
  73. turtle.turnLeft()
  74. end
  75. print("y:",j," von ",y)
  76. end
  77. print("Returning Home")
  78. if y%2 == 0 then
  79. TurnAround()
  80. for k=0, x, 1 do
  81. Mv()
  82. end
  83. end
  84. turtle.turnRight()
  85. for j=0, y+1, 1 do
  86. Mv()
  87. end
  88. turtle.turnRight()
  89. end
  90.  
  91. function TurnAround()
  92. turtle.turnLeft()
  93. turtle.turnLeft()
  94. end
  95.  
  96. function Chest()
  97. print("Dropping off items...")
  98. TurnAround()
  99. for n=5, 16, 1 do
  100. turtle.select(n)
  101. turtle.drop()
  102. end
  103. TurnAround()
  104. end
  105.  
  106. Startup()
  107. while true do
  108. CheckField()
  109. Chest()
  110. os.sleep(900)
  111. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement