Advertisement
Guest User

plant.lua

a guest
Nov 12th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. function turnaroundLeft()
  2. turtle.turnLeft()
  3. turtle.forward()
  4. turtle.turnLeft()
  5. end
  6.  
  7. function turnaroundRight()
  8. turtle.turnRight()
  9. turtle.forward()
  10. turtle.turnRight()
  11. end
  12.  
  13. function isEven(x)
  14.     if (x % 2 == 0) then
  15.         return 1
  16.     else
  17.         return 0
  18.     end
  19. end
  20.  
  21. function runHarvestPlant()
  22.     for i = 0, 21 do
  23.     currentBlockSuccess, currentBlockData = turtle.inspectDown()
  24.     if (currentBlockSuccess) then
  25.         if (currentBlockData["name"] == "minecraft:wheat" ) then
  26.             if(7 == currentBlockData["state"]["age"]) then
  27.                 turtle.digDown()
  28.                 for s = 0, 3 do turtle.suckDown() end
  29.                 turtle.placeDown()
  30.             end
  31.            for s = 0, 3 do turtle.suckDown() end
  32.         end
  33.     turtle.placeDown()
  34.     turtle.forward()
  35.     for s = 0, 3 do turtle.suckDown() end
  36.     end
  37.    
  38.    end
  39.     turtle.forward()
  40.     end
  41.  
  42.  
  43. turtle.placeDown()
  44.  
  45. --runHarvestPlant()
  46. function field()
  47. for j = 0, 5 do
  48. turtle.placeDown()
  49. runHarvestPlant()
  50. if (isEven(j)==1) then
  51. turnaroundLeft()
  52. else
  53. turnaroundRight()
  54. end
  55. turtle.placeDown()
  56. end
  57. turtle.turnRight()
  58. for f = 0, 5 do
  59. turtle.forward()
  60. end
  61. turtle.turnLeft()
  62. end
  63.  
  64. field()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement