Wiiplay123

Wii Turtle Miner v7.0

Feb 16th, 2015
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.08 KB | None | 0 0
  1. local blacklist = {"chisel:limestone","Magneticraft:limestone","BiomesOPlenty:limestone","chisel:granite","chisel:marble","chisel:diorite","chisel:andesite","minecraft:tallgrass","minecraft:sand","minecraft:diorite","minecraft:andesite","minecraft:granite","minecraft:grass", "minecraft:bedrock","minecraft:flowing_lava","minecraft:flowing_water","minecraft:lava","minecraft:water","chisel:marble","minecraft:stone","minecraft:cobblestone","minecraft:dirt","minecraft:gravel"}
  2.  
  3. function check(thing)
  4. if thing ~= nil then
  5. for i, v in pairs(blacklist) do
  6. if thing.name == v then
  7. return false
  8. end
  9. end
  10. return true
  11. end
  12. return false
  13. end
  14.  
  15. function turtleRefillThing()
  16. if turtle.getFuelLevel() ~= "unlimited" then
  17. if turtle.getFuelLevel() < (turtle.getFuelLimit() / 5) then
  18. local nums = {}
  19. for p = 1, 16 do
  20. local o = turtle.getItemDetail(p)
  21. if o ~= nil then
  22. if o.name == "minecraft:coal" or o.name == "minecraft:planks" or o.name == "minecraft:fence" then
  23. table.insert(nums,p)
  24. end
  25. end
  26. end
  27. for o, p in pairs(nums) do
  28. turtle.select(p)
  29. local itemName = (turtle.getItemDetail(p))
  30. if itemName == nil then
  31. itemName = {}
  32. itemName["name"] = "EMPTY"
  33. end
  34. if check(itemName) == false then
  35. turtle.select(p)
  36. turtle.drop()
  37. turtle.dropDown()
  38. turtle.dropUp()
  39. end
  40. while turtle.getFuelLevel() < turtle.getFuelLimit() / 5 and turtle.getItemCount(turtle.getSelectedSlot()) > 0 and turtle.getItemDetail(turtle.getSelectedSlot()) ~= nil do
  41. turtle.refuel()
  42. end
  43. if turtle.getFuelLevel() >= turtle.getFuelLimit() / 5 then
  44. break
  45. end
  46. end
  47. else
  48. turtle.refuel()
  49. end
  50. end
  51. end
  52.  
  53. function mineOre()
  54. local work, inspect = turtle.inspect()
  55. local worku, inspectu = turtle.inspectUp()
  56. local workd, inspectd = turtle.inspectDown()
  57. if work then
  58. if check(inspect) then
  59. local swood = turtle.dig()
  60. if not swood then break end
  61. turtle.forward()
  62. turtle.turnLeft()
  63. for i = 1, 3 do
  64. local wo, ex = turtle.inspect()
  65. local wo2, ex2 = turtle.inspectDown()
  66. local wo3, ex3 = turtle.inspectUp()
  67. if wo and check(ex) and swood then
  68. mineOre()
  69. end
  70. if wo2 and check(ex2) then
  71. local meow = turtle.digDown()
  72. if meow then
  73. turtle.down()
  74. mineOre()
  75. turtle.up()
  76. end
  77. end
  78. if wo3 and check(ex3) then
  79. local meow = turtle.digUp()
  80. if meow then
  81. turtle.up()
  82. mineOre()
  83. turtle.down()
  84. end
  85. end
  86. if i < 3 then
  87. turtle.turnRight()
  88. end
  89. end
  90. turtle.turnLeft()
  91. turtle.back()
  92. end
  93. end
  94. if worku then
  95. if check(inspectu) then
  96. turtle.digUp()
  97. turtle.up()
  98. mineOre()
  99. turtle.down()
  100. end
  101. end
  102. if workd then
  103. if check(inspectd) then
  104. turtle.digDown()
  105. turtle.down()
  106. mineOre()
  107. turtle.up()
  108. end
  109. end
  110. end
  111.  
  112. turtleRefillThing()
  113. turtle.select(1)
  114. n = 0
  115. built = false
  116. done = false
  117. while done == false do
  118. turtle.digDown()
  119. if (n == 0) then
  120. turtleRefillThing()
  121. turtle.down()
  122. if (turtle.detectDown()) then
  123. turtle.digDown()
  124. end
  125. n = n + 1
  126. end
  127. for i = 1,4 do
  128. mineOre()
  129. turtle.turnRight()
  130. end
  131. if turtle.detectDown() then
  132. for i = 1,n do
  133. turtleRefillThing()
  134. repeat
  135. if turtle.detectUp() then
  136. turtle.digUp()
  137. end
  138. until turtle.up()
  139. end
  140. turtle.select(1)
  141. turtle.placeDown()
  142. done = true
  143. else
  144. n = n + 1
  145. turtleRefillThing()
  146. turtle.down()
  147. end
  148. end
Advertisement
Add Comment
Please, Sign In to add comment