Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. -- local x1 = -352
  2. -- local y1 = 61
  3. -- local z1 = 1764
  4. -- local x2 = -273
  5. -- local y2 = 70
  6. -- local z2 = 1804
  7.  
  8. -- local storageX = -303
  9. -- local storageY = 67
  10. -- local storageZ = 1758
  11.  
  12. local x1 = -85
  13. local y1 = 55
  14. local z1 = -1831
  15. local x2 = -81
  16. local y2 = 58
  17. local z2 = -1825
  18.  
  19. local storageX = -88
  20. local storageY = 56
  21. local storageZ = -1832
  22. local p = peripheral.wrap("top")
  23.  
  24. function takeSapling()
  25. p.addArea(storageX, storageY, storageZ)
  26. p.clearWhitelistItemFilter()
  27. p.addWhitelistItemFilter("Forestry:sapling", 0, false, false, false, false)
  28. p.setSides(true, true, true, true, true, true)
  29. p.setUseCount(true)
  30. p.setCount(64)
  31. p.setAction("inventoryImport")
  32.  
  33. p.clearArea()
  34. waitDone()
  35. end
  36.  
  37. function noSapling()
  38. p.clearWhitelistItemFilter()
  39. p.addWhitelistItemFilter("Forestry:sapling", 0, false, false, false, false)
  40. setOperator("=")
  41. setCount(0)
  42. setAction("droneConditionItem")
  43.  
  44. waitDone()
  45. return evaluateCondition()
  46. end
  47.  
  48. function canPlant(x, y, z)
  49. p.addArea(x, y, z)
  50. p.showArea()
  51. p.clearWhitelistItemFilter()
  52. p.addWhitelistItemFilter("minecraft:grass", 0, false, false, false, false)
  53. p.addWhitelistItemFilter("minecraft:dirt", 0, false, false, false, false)
  54. p.setIsAndFunction(true)
  55. p.setAction("conditionBlock")
  56.  
  57. p.clearArea()
  58. waitDone()
  59. return evaluateCondition()
  60. end
  61.  
  62. function plantSapling(x, y, z)
  63. p.addArea(x, y, z)
  64. p.setSide("top", true)
  65. p.setAction("blockRightClick")
  66.  
  67. p.clearArea()
  68. waitDone()
  69. end
  70.  
  71. function waitDone()
  72. while not p.isActionDone() do
  73. sleep(1)
  74. end
  75. end
  76.  
  77. while true do
  78. for x = x1, x2 do
  79. for y = y1, y2 do
  80. for z = z1, z2 do
  81. if noSapling then
  82. print("taking saplings")
  83. takeSapling()
  84. end
  85.  
  86. print("check can plant saplings")
  87. if canPlant(x, y, z) then
  88. print("plant saplings")
  89. plantSapling(x, y, z)
  90. end
  91. end
  92. end
  93. end
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement