Advertisement
Guest User

MiningTest6

a guest
Feb 17th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.65 KB | None | 0 0
  1. -- Minecraft mod 'ComputerCraft' Script
  2. -- for Automated trees search
  3.  
  4. -- Each run requires: nil
  5.  
  6. -- Patrol movements
  7. for i = 1,10 do -- number of turns
  8. for k = 1,2 do
  9. for j = 1,i do
  10.  
  11.  
  12. for u = 1,10 do -- there cant be 10 blocks high, right?
  13.  
  14.  
  15. -- what's in front of me?
  16. local obsFront, dataFront = turtle.inspect()
  17.  
  18. if not obsFront then -- If there's nothing in front of me:
  19.  
  20. turtle.forward()
  21.  
  22. -- I moved forward, what's below of me?
  23. local obsDown, dataDown = turtle.inspectDown()
  24.  
  25. -- If there's nothing below of me:
  26. if not obsDown then
  27. for i = 1,10 do -- there cant be a 10 block cliff, please god
  28.  
  29. turtle.down()
  30.  
  31. -- I moved down, what's below of me?
  32. local obsDown, dataDown = turtle.inspectDown()
  33.  
  34. -- If what I have below are leaves, dig. otherwise end:
  35. if obsDown then
  36. if dataDown.name == 'minecraft:leaves' then
  37. turtle.digDown()
  38. else
  39. break
  40. end
  41. end
  42.  
  43. end
  44. end
  45.  
  46. break
  47.  
  48. elseif dataFront.name == 'minecraft:log' then -- If there's a tree in front of me:
  49.  
  50. shell.run('choptree') -- I chop the tree and move forward where the tree was
  51.  
  52. -- I moved forward, what's below of me?
  53. local obsDown, dataDown = turtle.inspectDown()
  54.  
  55. -- If there's tree below me:
  56. if dataDown.name == 'minecraft:log' then
  57. for i = 1,10 do -- there cant be 10 logs below, please god
  58.  
  59. turtle.digDown()
  60. turtle.down()
  61.  
  62. -- I moved down, what's below of me?
  63. local obsDown, dataDown = turtle.inspectDown()
  64.  
  65. -- If there are no more logs end:
  66. if dataDown.name ~= 'minecraft:log' then
  67. break
  68. end
  69.  
  70. end
  71. end
  72.  
  73. break
  74.  
  75. elseif dataFront.name == 'minecraft:leaves' then -- If there are leaves in front of me:
  76.  
  77. turtle.dig()
  78. turtle.forward()
  79.  
  80. -- I moved forward, what's below of me?
  81. local obsDown, dataDown = turtle.inspectDown()
  82.  
  83. -- If there's nothing below of me:
  84. if not obsDown then
  85. for i = 1,10 do -- there cant be a 10 block cliff, please god
  86.  
  87. turtle.down()
  88.  
  89. -- I moved down, what's below of me?
  90. local obsDown, dataDown = turtle.inspectDown()
  91.  
  92. -- If what I have below are leaves, dig. otherwise end:
  93. if obsDown then
  94. if dataDown.name == 'minecraft:leaves' then
  95. turtle.digDown()
  96. else
  97. break
  98. end
  99. end
  100.  
  101. end
  102. end
  103.  
  104. break
  105.  
  106. else -- If there's something that's not a tree in front of me:
  107.  
  108.  
  109. -- I need to climb that block
  110. -- Can I go up? What's over me?
  111. local obsUp, dataUp = turtle.inspectUp()
  112.  
  113. -- If there are leaves, dig 'em
  114. if dataUp.name == 'minecraft:leaves' then
  115. turtle.digUp()
  116. turtle.up()
  117. else -- if not, then just go up
  118. if not obsUp then -- Only if theres actually air
  119. turtle.up()
  120. end
  121. end
  122.  
  123.  
  124. end
  125.  
  126. end
  127.  
  128. end
  129.  
  130. turtle.turnRight()
  131. end
  132. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement