Advertisement
temposabel

Untitled

Dec 20th, 2021 (edited)
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. function depo()
  2. throw_shit()
  3. refuel()
  4. end
  5.  
  6. function findslot(name,skipg)
  7. skipg = skipg or false
  8. if name == "minecraft:grass_block" then
  9. name = "minecraft:dirt"
  10. end
  11.  
  12. if name == "minecraft:coal_ore" then
  13. name = "minecraft:coal"
  14. end
  15.  
  16. if name == "minecraft:redstone_ore" then
  17. name = "minecraft:redstone"
  18. end
  19.  
  20. if name == "minecraft:lapis_ore" then
  21. name = "minecraft:lapis_lazuli"
  22. end
  23.  
  24. if name == "minecraft:emerald_ore" then
  25. name = "minecraft:emerald"
  26. end
  27.  
  28. if name == "minecraft:diamond_ore" then
  29. name = "minecraft:diamond"
  30. end
  31.  
  32. if name == "minecraft:stone" then
  33. name = "minecraft:cobblestone"
  34. end
  35. if name == "minecraft:cobweb" then
  36. name = "minecraft:string"
  37. end
  38. if name == "minecraft:gravel" then
  39. return 1
  40. end
  41.  
  42. if name then
  43. firstempty = false
  44. for i = 1,16 do
  45. slotitem = turtle.getItemDetail(i)
  46. if slotitem then
  47. if name == slotitem.name then
  48. if slotitem.count < 64 then
  49. return i
  50. end
  51. end
  52. else
  53. if not firstempty then firstempty = i end
  54. end
  55. end
  56. if firstempty then return firstempty end
  57. return false
  58. end
  59. return 1
  60. end
  61.  
  62.  
  63. function tablelength(T)
  64. local count = 0
  65. for _ in pairs(T) do count = count + 1 end
  66. return count
  67. end
  68.  
  69. -- vvv fuel limit removed, replace true with
  70. function refuel()
  71. print(turtle.getFuelLevel())
  72. if turtle.getFuelLevel() < 60 then
  73. found = find("minecraft:coal")
  74. if found then
  75. turtle.select(found)
  76. turtle.refuel(1)
  77. end
  78. end
  79. end
  80.  
  81.  
  82. intebajs = {'minecraft:diamond', 'minecraft:iron_ore', 'minecraft:gold_ore', 'minecraft:emerald', 'minecraft:obsidian', 'minecraft:coal'}
  83.  
  84. function in_list (tab, val)
  85. for index, value in ipairs(tab) do
  86. if value == val then
  87. return true
  88. end
  89. end
  90.  
  91. return false
  92. end
  93.  
  94. function throw_shit()
  95. for i = 1,16 do
  96. sname = turtle.getItemDetail(i)
  97. if sname then
  98. if not in_list(intebajs,sname.name) then turtle.select(i) turtle.dropDown() end
  99. end
  100. end
  101. end
  102.  
  103. function find(name)
  104. for i = 1,16 do
  105. sname = turtle.getItemDetail(i)
  106. if sname then
  107. sname = sname.name
  108. if name == sname then
  109. return i
  110. end
  111. end
  112. end
  113. return false
  114. end
  115.  
  116. function findnextslot()
  117. for i = 1,16 do
  118. if turtle.getItemCount(i) ~= 0 then return i
  119. end
  120. end
  121. end
  122.  
  123.  
  124. function mine()
  125. refuel()
  126. itemsuc,item = turtle.inspectUp()
  127. if item["name"] == "minecraft:bedrock" then turtle.back() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() os.reboot() end
  128.  
  129. if itemsuc then
  130. --print(item["name"])
  131. slot = findslot(item["name"])
  132. if slot then
  133. turtle.select(slot)
  134. turtle.digUp()
  135. else
  136. depo()
  137. turtle.select(1)
  138. turtle.digUp()
  139.  
  140. end
  141. end
  142. itemsuc,item = turtle.inspectDown()
  143. if item["name"] == "minecraft:bedrock" then turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() os.reboot() end
  144. if itemsuc then
  145. slot = findslot(item["name"])
  146. if slot then
  147. turtle.select(slot)
  148. turtle.digDown()
  149. else
  150. depo()
  151. turtle.select(1)
  152. turtle.digDown()
  153. end
  154. end
  155. itemsuc,item = turtle.inspect()
  156. if item["name"] == "minecraft:bedrock" then turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() turtle.up() os.reboot() end
  157. --print(item)
  158. if itemsuc then
  159. slot = findslot(item["name"])
  160. if slot then
  161. turtle.select(slot)
  162. turtle.dig()
  163. else
  164. depo()
  165. turtle.select(1)
  166. turtle.dig()
  167. end
  168. end
  169.  
  170. suc = turtle.forward()
  171. return suc
  172. end
  173.  
  174. xl = 5
  175. yl = 10
  176. de = 2
  177.  
  178. function walk (len)
  179. x = 0
  180. while x < len do
  181. if mine() then x = x + 1 end
  182. end
  183. end
  184. for zw = 0,de do
  185. for xw = 1,xl do
  186. refuel()
  187. for yw = 1,yl-1 do
  188. walk(1)
  189. end
  190. turtle.turnRight()
  191. walk(1)
  192. turtle.turnRight()
  193. for yw = 1,yl-1 do
  194. walk(1)
  195. end
  196. if xw ~= xl then
  197. turtle.turnLeft()
  198. walk(1)
  199. turtle.turnLeft()
  200. else
  201. if zw ~= de then
  202. turtle.digUp()
  203. turtle.digDown()
  204. turtle.down()
  205. turtle.digDown()
  206. turtle.down()
  207. turtle.digDown()
  208. turtle.down()
  209. turtle.turnRight()
  210. end
  211. end
  212. end
  213. end
  214.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement