Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. this = turtle
  2.  
  3. function harvest()
  4. local success, t = this.inspectDown()
  5. if success
  6. then
  7. print("inspect = true")
  8. if t.name == "AgriCraft:crops"
  9. then
  10. print("name = true")
  11. if t.metadata == 7
  12. then
  13. print("metadata = true")
  14. this.digDown()
  15. return true
  16. end
  17. end
  18. end
  19. return false
  20. end
  21.  
  22. function getItemLocation(itemName)
  23. for i=1,16,1
  24. do
  25. local item = this.getItemDetail()
  26. if item.name == itemName
  27. then
  28. return i
  29. end
  30. end
  31.  
  32. return -1
  33. end
  34.  
  35. function getCropSticksInventoryLocation()
  36. return getItemLocation("AgriCraft:cropsItem")
  37. end
  38.  
  39. function getSeedInventoryLocation(seedType)
  40. return getItemLocation(seedType)
  41. end
  42.  
  43. function placeInventory(slot)
  44. this.select(slot)
  45. this.placeDown()
  46. end
  47.  
  48. function harvestCrop(seedType)
  49. local harvested = harvest()
  50. if harvested
  51. then
  52. local stick = getCropSticksInventoryLocation()
  53. local seed = getSeedInventoryLocation(seedType)
  54.  
  55. if stick > 0
  56. then
  57. placeInventory(stick)
  58. end
  59.  
  60. if seed > 0
  61. then
  62. placeInventory(seed)
  63. end
  64. end
  65. end
  66.  
  67. function advance(x,y)
  68. if y == 7
  69. then
  70. this.turnLeft()
  71. this.forward()
  72. this.turnLeft()
  73. else
  74. this.forward()
  75. end
  76. end
  77.  
  78. function harvestEnderGrid()
  79. for i=1,7,1
  80. do
  81. for j=1,7,1
  82. do
  83. harvestCrop("magicalcrops:EndermanSeeds")
  84. advance(i,j)
  85. end
  86. end
  87. end
  88.  
  89. harvestEnderGrid()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement