temposabel

Untitled

Dec 18th, 2021 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1.  
  2.  
  3. size = 10
  4.  
  5. function tablelength(T)
  6. local count = 0
  7. for _ in pairs(T) do count = count + 1 end
  8. return count
  9. end
  10.  
  11.  
  12. function refuel()
  13. print(turtle.getFuelLevel())
  14. if turtle.getFuelLevel() < 200 then
  15. found = find("minecraft:coal")
  16. if found then
  17. turtle.select(found)
  18. turtle.refuel(4)
  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. sname = turtle.getItemDetail(i)
  38. if sname then
  39. if not in_list(intebajs,sname.name) then turtle.select(i) turtle.dropDown() end
  40. end
  41. end
  42. end
  43.  
  44. function find(name)
  45. for i = 1,16 do
  46. sname = turtle.getItemDetail(i)
  47. if sname then
  48. sname = sname.name
  49. if name == sname then
  50. return i
  51. end
  52. end
  53. end
  54. return false
  55. end
  56.  
  57. function mine()
  58. turtle.dig()
  59. turtle.digUp()
  60. turtle.digDown()
  61. suc = turtle.forward()
  62. return suc
  63. end
  64.  
  65. function walk (len)
  66. x = 0
  67. while x < len do
  68. if mine() then x = x + 1 end
  69. end
  70. end
  71.  
  72.  
  73.  
  74. for i = 0,size do
  75. walk(size - i)
  76. refuel()
  77. turtle.turnRight()
  78. throw_shit()
  79. walk(size - i)
  80. turtle.turnRight()
  81. throw_shit()
  82. end
  83.  
Add Comment
Please, Sign In to add comment