Advertisement
temposabel

Untitled

Dec 18th, 2021 (edited)
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. require("a")
  2.  
  3.  
  4. size = 10
  5.  
  6. function tablelength(T)
  7. local count = 0
  8. for _ in pairs(T) do count = count + 1 end
  9. return count
  10. end
  11.  
  12.  
  13. function refuel()
  14. for i = 1,16 do
  15. turtle.select(i)
  16. print(turtle.getFuelLevel)
  17. if turtle.getFuelLevel < 200 then
  18. turtle.refuel(10)
  19. end
  20. end
  21. end
  22.  
  23. intebajs = {'minecraft:diamond', 'minecraft:iron_ore', 'minecraft:gold_ore', 'minecraft:emerald', 'minecraft:obsidian', 'minecraft:coal'}
  24.  
  25. function in_list (tab, val)
  26. for index, value in ipairs(tab) do
  27. if value == val then
  28. return true
  29. end
  30. end
  31.  
  32. return false
  33. end
  34.  
  35. function throw_shit()
  36. for i = 1,16 do
  37. turtle.select(i)
  38. sname = turtle.getItemDetail()
  39. if sname then
  40. if not in_list(intebajs,sname) then turtle.dropDown() end
  41. end
  42. end
  43. end
  44.  
  45. function find(name)
  46. local d = {}
  47. for i = 1,16 do
  48. turtle.select(i)
  49. sname = turtle.getItemDetail()
  50. if sname then
  51. sname = sname.name
  52. if name == sname
  53. then
  54. d[tablelength(d)+1] = i end
  55. end
  56. end
  57. return d
  58. end
  59.  
  60. function mine()
  61. turtle.dig()
  62. turtle.digUp()
  63. turtle.digDown()
  64. suc = turtle.forward()
  65. return suc
  66. end
  67.  
  68. function walk (len)
  69. x = 0
  70. while x < len do
  71. if mine() then x = x + 1 end
  72. end
  73. end
  74.  
  75.  
  76.  
  77. for i = 0,size do
  78. walk(size - i)
  79. refuel()
  80. turtle.turnRight()
  81. throw_shit()
  82. walk(size - i)
  83. turtle.turnRight()
  84. throw_shit()
  85. end
  86.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement