Advertisement
temposabel

Untitled

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