SHARE
TWEET

Untitled

xmann110 Aug 11th, 2019 11 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local levelHeight = 3
  2. local currLevel = 0
  3. local maxLevel = 5
  4.  
  5. function refuel()
  6.     if turtle.getFuelLevel() < 5 then
  7.         turtle.select(1)
  8.         turtle.refuel(1)
  9.     end
  10. end
  11.  
  12. function startup()
  13.     refuel()
  14.     turtle.up()
  15.     turtle.forward()
  16.     turtle.forward()
  17.     turtle.forward()
  18.     turtle.forward()
  19.     turtle.forward()
  20. end
  21.  
  22. function harvest(level)
  23.     goToLevel(level)
  24.     turtle.turnLeft()
  25.     turtle.turnLeft()
  26.     turtle.forward()
  27.     turtle.forward()
  28.     turtle.forward()
  29.     turtle.turnRight()
  30.     turtle.forward()
  31.     turtle.forward()
  32.     turtle.forward()
  33.     turtle.forward()
  34.     turtle.turnRight()
  35.  
  36.     for j=1, 4 do
  37.         for i=1, 8 do
  38.             refuel()
  39.             harvestCrop()
  40.             turtle.forward()
  41.         end
  42.         turtle.turnRight()
  43.         turtle.forward()
  44.         harvestCrop()
  45.         turtle.turnRight()
  46.         for i=1, 8 do
  47.             refuel()
  48.             harvestCrop()
  49.             turtle.forward()
  50.         end
  51.         turtle.turnLeft()
  52.         harvestCrop()
  53.         turtle.forward()
  54.         turtle.turnLeft()
  55.     end
  56.     for i=1, 8 do
  57.         refuel()
  58.         harvestCrop()
  59.         turtle.forward()
  60.     end
  61.     harvestCrop()
  62.     turtle.turnLeft()
  63.     turtle.forward()
  64.     turtle.forward()
  65.     turtle.forward()
  66.     turtle.forward()
  67.     turtle.turnLeft()
  68.     turtle.forward()
  69.     turtle.forward()
  70.     turtle.forward()
  71.     turtle.forward()
  72.     turtle.forward()
  73.     turtle.turnLeft()
  74.     turtle.turnLeft()
  75. end
  76.  
  77. function harvestCrop()
  78.     a, b = turtle.inspectDown()
  79.     if a then
  80.         if b.state.age == 3 then
  81.             turtle.select(2)
  82.             turtle.digDown()
  83.             turtle.placeDown()
  84.         end
  85.     end
  86. end
  87.  
  88. function goToLevel(level)
  89.     if level == currLevel then
  90.         return
  91.     end
  92.     refuel()
  93.     turtle.forward()
  94.  
  95.     local blocksDown = 0
  96.  
  97.     while not turtle.detectDown() do
  98.         refuel()
  99.         if turtle.down() then
  100.             blocksDown = blocksDown + 1
  101.         end
  102.     end
  103.  
  104.     for i=2, 16 do
  105.         turtle.select(i)
  106.         turtle.dropDown()
  107.     end
  108.  
  109.     for i=1, blocksDown do
  110.         refuel()
  111.         while not turtle.up() do
  112.             os.sleep(0.1)
  113.         end
  114.     end
  115.  
  116.     if currLevel < level then
  117.         for i=1, level - currLevel do
  118.             for i=1, levelHeight do
  119.                 refuel()
  120.                 turtle.up()
  121.             end
  122.         end
  123.     end
  124.  
  125.     if currLevel > level then
  126.         for i=1, currLevel - level do
  127.             for i=1, levelHeight do
  128.                 refuel()
  129.                 turtle.down()
  130.             end
  131.         end
  132.     end
  133.  
  134.     turtle.back()
  135.     currLevel = level
  136. end
  137.  
  138. function checkHarvest()
  139.     for level=0, maxLevel do
  140.         harvest(level)
  141.     end
  142. end
  143.  
  144. startup()
  145. while true do
  146.     checkHarvest(currLevel)
  147.     goToLevel(0)
  148.     os.sleep(60 * 5)
  149. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top