Reskatron

beetsucc

Feb 7th, 2024 (edited)
819
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | Gaming | 0 0
  1.  
  2. function getItemIndex(itemName)
  3.     for slot = 1, 16, 1 do
  4.         local item = turtle.getItemDetail(slot)
  5.         if(item ~= nil) then
  6.             if(item["name"] == itemName) then
  7.                 return slot
  8.             end
  9.         end
  10.     end
  11. end
  12.  
  13. function checkLeft()
  14.     turtle.turnLeft()
  15.     if (turtle.detect())
  16.     then
  17.         return true
  18.     end
  19.     turtle.forward()
  20.     turtle.turnRight()
  21.     return false
  22. end
  23.  
  24. function zigzag()
  25.     turtle.turnRight()
  26.     turtle.forward()
  27.     turtle.turnLeft()
  28.     turtle.turnLeft()
  29.     turtle.forward()
  30.     end
  31.  
  32. function succ()
  33.     for i = 1, 6, 1
  34.     do
  35.         turtle.suckDown()
  36.     end
  37. end
  38.  
  39. while(1)
  40. do
  41.     isBlock, data = turtle.inspectDown()
  42.    
  43.     if(isBlock)
  44.     then
  45.         if (data['state']['age'] == 7)
  46.         then
  47.             turtle.digDown()
  48.             succ()
  49.             potatoIndex = getItemIndex("minecraft:beetroots")
  50.             turtle.select(potatoIndex)
  51.             turtle.place()
  52.             turtle.dropDown(turtle.getItemCount(potatoIndex) - 1)
  53.         end
  54.     else
  55.         succ()
  56.         potatoIndex = getItemIndex("minecraft:beetroot_seeds")
  57.         turtle.placeDown()
  58.     end
  59.  
  60.    
  61.     if (checkLeft())
  62.     then
  63.         turtle.turnRight()
  64.         while(not turtle.detect())
  65.         do
  66.             function zigzag()
  67.         end
  68.     end
  69. end    
  70.  
Advertisement
Add Comment
Please, Sign In to add comment