TechManDylan

TurtleFarmerDeluxe

Jan 20th, 2021 (edited)
715
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Variables
  2. inspectBool, blockTable = turtle.inspectDown()
  3. sideTurned = ""
  4. onSignal = redstone.getInput("bottom")
  5.  
  6. function sideToTurn()
  7.     if sideTurned == "" or "right" then
  8.         turtle.turnLeft()
  9.         turtle.forward()
  10.         turtle.forward()
  11.         turtle.turnLeft()
  12.         turtle.forward()
  13.     elseif sideTurned() == "left" then
  14.         turtle.turnRight()
  15.         turtle.forward()
  16.         turtle.forward()
  17.         turtle.turnRight()
  18.         turtle.forward()
  19.     end
  20. end
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. function checkBlock()
  28.     if inspectBool == true then
  29.         for k,v in pairs(blockTable) do
  30.             if v == "minecraft:melon_block" or v == "minecraft:pumpkin" then       
  31.                 turtle.digDown()
  32.             end
  33.             if v == "minecraft:glass" then
  34.                 sideToTurn()
  35.             end
  36.             if v == "minecraft:stonebrick" then
  37.                 lookingForMonitor()
  38.             else
  39.                 turtle.placeDown()
  40.                 turtle.suckDown(64)
  41.                 turtle.suckDown(64)
  42.             end
  43.         end
  44.     else
  45.     turtle.forward()
  46.     end
  47. end
  48.  
  49. function lookingForMonitor()
  50.     if inspectBool == true then
  51.         for k,v in pairs(blockTable) do
  52.             if v == "computercraft:peripheral" then
  53.                 turtle.turnLeft()
  54.             else
  55.                 turtle.forward()
  56.             end
  57.         end
  58.     end
  59. end
  60.  
  61.  
  62.  
  63. function harvestCrops()
  64.     while true do
  65.     checkBlock()
  66.     end
  67. end
  68.  
  69.     repeat redstone.getInput("bottom")
  70.     sleep(5)
  71.     until redstone.getInput("bottom") == true
  72.         --Move Turtle to start of crops.
  73.         turtle.forward()
  74.         turtle.turnLeft()
  75.         turtle.forward()
  76.         turtle.forward()
  77.         turtle.forward()
  78.         turtle.turnRight()
  79.         --Selecting slot 1. This is where you should place a tool so the Turtle can use it to harvest crops.It does not use durability.
  80.         turtle.select(1)
  81.         harvestCrops()
RAW Paste Data