NoobieDoobie

Untitled

Feb 26th, 2021 (edited)
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.63 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.         end
  64.         CheckBelow()
  65.         if j%2 == 1 then
  66.             turtle.turnRight()
  67.             Mv()
  68.             turtle.turnRight()
  69.         elseif not j==y then
  70.             turtle.turnLeft()
  71.             Mv()
  72.             turtle.turnLeft()
  73.         end
  74.     end
  75.     if y%2 == 0 then
  76.         TurnAround()
  77.         for k=0, x, 1 do
  78.             Mv()
  79.         end
  80.     end
  81.     turtle.turnRight()
  82.     for j=0, y+1, 1 do
  83.         Mv()
  84.     end
  85.     turtle.turnRight()
  86. end
  87.  
  88. function TurnAround()
  89.     turtle.turnLeft()
  90.     turtle.turnLeft()
  91. end
  92.  
  93. function Chest()
  94.     TurnAround()
  95.     for n=5, 16, 1 do
  96.         turtle.select(n)
  97.         turtle.drop()
  98.     end
  99.     TurnAround()
  100. end
  101.  
  102. Startup()
  103. while true do
  104.     CheckField()
  105.     Chest()
  106.     os.sleep(900)
  107. end
Add Comment
Please, Sign In to add comment