temposabel

Untitled

Dec 18th, 2021 (edited)
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. --X0y7V6Qivb
  2.  
  3.  
  4. function tablelength(T)
  5. local count = 0
  6. for _ in pairs(T) do count = count + 1 end
  7. return count
  8. end
  9.  
  10.  
  11. function refuel()
  12. for i = 1,16 do
  13. turtle.select(i)
  14. print(turtle.getFuelLevel())
  15. if turtle.getFuelLevel() < 200 then
  16. turtle.refuel(10)
  17. end
  18. end
  19. end
  20.  
  21. intebajs = {'minecraft:diamond', 'minecraft:iron_ore', 'minecraft:gold_ore', 'minecraft:emerald', 'minecraft:obsidian', 'minecraft:coal'}
  22.  
  23. function in_list (tab, val)
  24. for index, value in ipairs(tab) do
  25. if value == val then
  26. return true
  27. end
  28. end
  29.  
  30. return false
  31. end
  32.  
  33. function throw_shit()
  34. for i = 1,16 do
  35. turtle.select(i)
  36. sname = turtle.getItemDetail()
  37. if sname then
  38. print(in_list(intebajs,sname.name))
  39. if not in_list(intebajs,sname.name) then 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 findnextslot()
  58. for i = 1,16 do
  59. if turtle.getItemCount(i) ~= 0 then return i
  60. end
  61. end
  62. end
  63.  
  64. function mine()
  65. turtle.digDown()
  66. found = find("minecraft:dirt")
  67. if found then
  68. if turtle.select(found) then
  69. turtle.placeDown()
  70. end
  71. end
  72. suc = turtle.forward()
  73. return suc
  74. end
  75.  
  76.  
  77. function walk (len)
  78. x = 0
  79. while x < len do
  80. if mine() then x = x + 1 end
  81. end
  82. end
  83.  
  84. local x = 0
  85. local y = 0
  86.  
  87. while true do
  88. if turtle.inspect() then
  89. print("hittade block x its:" .. x)
  90. turtle.turnRight()
  91. break
  92. end
  93. walk(1)
  94. x = x+1
  95. end
  96.  
  97. while true do
  98. if turtle.inspect() then
  99. print("hittade block y its: " .. y)
  100. turtle.turnRight()
  101. break
  102. end
  103. walk(1)
  104. y = y+1
  105. end
  106.  
  107.  
  108.  
Add Comment
Please, Sign In to add comment