Advertisement
arismoko

Farmer 3.0 (bell pepper)

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