Advertisement
Guest User

farmer

a guest
Sep 25th, 2021
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. function wait()
  2.     --Anytime in seconds you want
  3.     sleep(15)
  4. end
  5.  
  6. --Harvests lettuce in front of it then drops all the lettuce in selected slot except 1.
  7. function dig()
  8.     turtle.dig()
  9.     turtle.suck()
  10.     turtle.suckDown()
  11.     turtle.suckUp()
  12.     turtle.place()
  13.     for i = 1,turtle.getItemCount() - 1, 1 do
  14.         turtle.dropDown()
  15.     end
  16. end
  17.  
  18. --Checks if lettuce is planted, if so checks if its ready for harvesting
  19. function inspect()
  20.     local booleanValue, lettuceInfo = turtle.inspect()
  21.  
  22.     if (not booleanValue) then
  23.         for i = 1, 16, 1 do
  24.             turtle.select(i)
  25.             turtle.getItemDetail(i)
  26.             print(turtle.getItemDetail(i))
  27.             if(turtle.getItemDetail(i) ~= nil) then
  28.                 if (turtle.getItemDetail(i).name == "pamhc2crops:pamlettucecrop") then
  29.                     turtle.place()
  30.                     break
  31.                 end
  32.             end
  33.         end
  34.         turtle.place()
  35.     else
  36.         if (lettuceInfo.state.age == 7) then
  37.             dig()
  38.             turtle.suck()
  39.             turtle.suckDown()
  40.             turtle.suckUp()
  41.             next()
  42.         else
  43.             wait()
  44.             inspect()
  45.         end
  46.     end
  47. end
  48.  
  49. --Moves forward and checks next lettuce, if it detects a block in front of it, turns around and goes back to start
  50. function next()
  51.     turtle.turnLeft()
  52.  
  53.     if (turtle.inspect() == false) then
  54.         turtle.forward()
  55.         turtle.turnRight()
  56.         turtle.suck()
  57.         turtle.suckDown()
  58.         turtle.suckUp()
  59.         inspect()
  60.     else
  61.         turtle.turnLeft()
  62.         turtle.turnLeft()
  63.  
  64.         while (turtle.inspect() == false) do
  65.             turtle.forward()
  66.         end
  67.  
  68.         turtle.turnLeft()
  69.         turtle.suck()
  70.         turtle.suckDown()
  71.         turtle.suckUp()
  72.         inspect()
  73.     end
  74. end
  75.  
  76. inspect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement