Advertisement
Guest User

AutoWood

a guest
Dec 18th, 2012
15,484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. local function checkFuel()
  2. if turtle.getFuelLevel() < 20 then
  3. turtle.select(1)
  4. turtle.refuel(1)
  5. end
  6. end
  7.  
  8. local function column()
  9. local height = 0
  10. while turtle.digUp() do
  11. turtle.dig()
  12. checkFuel()
  13. turtle.up()
  14. height = height + 1
  15. end
  16. turtle.dig()
  17.  
  18. checkFuel()
  19.  
  20. return height
  21. end
  22.  
  23. local function columnDown(height)
  24. for i=1,height do
  25. checkFuel()
  26. turtle.dig()
  27. turtle.digDown()
  28. turtle.down()
  29. end
  30. turtle.dig()
  31. end
  32.  
  33. local function digmove()
  34. checkFuel()
  35. turtle.dig()
  36. turtle.forward()
  37. end
  38.  
  39. local function fell()
  40. digmove()
  41. local height = column()
  42. turtle.turnRight()
  43. digmove()
  44. turtle.turnLeft()
  45. columnDown(height)
  46. end
  47.  
  48. local function replant()
  49. turtle.select(15)
  50. turtle.suck()
  51. turtle.place()
  52. turtle.turnLeft()
  53. turtle.suck()
  54. turtle.forward()
  55. turtle.suck()
  56. turtle.turnRight()
  57. turtle.suck()
  58. turtle.place()
  59. turtle.turnRight()
  60. turtle.suck()
  61. turtle.place()
  62. turtle.turnRight()
  63. turtle.suck()
  64. turtle.forward()
  65. turtle.suck()
  66. for slot=3,7 do
  67. turtle.select(slot)
  68. turtle.drop()
  69. end
  70. turtle.turnLeft()
  71. turtle.turnLeft()
  72. turtle.select(15)
  73. turtle.place()
  74. turtle.select(2)
  75. while not turtle.compare() do
  76. turtle.select(16)
  77. turtle.place()
  78. turtle.select(2)
  79. end
  80. end
  81.  
  82. function needCoal()
  83. return turtle.getItemCount(1) < 10
  84. end
  85.  
  86. function needBonemeal()
  87. return turtle.getItemCount(16) < 10
  88. end
  89.  
  90. function getCoal()
  91. turtle.turnRight()
  92. turtle.forward()
  93. turtle.forward()
  94. while turtle.getItemCount(1) < 60 do
  95. sleep(0.5)
  96. end
  97. turtle.turnRight()
  98. turtle.turnRight()
  99. turtle.forward()
  100. turtle.forward()
  101. turtle.turnRight()
  102. end
  103.  
  104. function getBonemeal()
  105. turtle.turnLeft()
  106. turtle.forward()
  107. while turtle.getItemCount(16) < 60 do
  108. sleep(0.5)
  109. end
  110. turtle.turnLeft()
  111. turtle.turnLeft()
  112. turtle.forward()
  113. turtle.turnLeft()
  114. end
  115.  
  116. while true do
  117. fell()
  118. replant()
  119. if needCoal() then
  120. getCoal()
  121. end
  122. if needBonemeal() then
  123. getBonemeal()
  124. end
  125. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement