Advertisement
temposabel

Untitled

Dec 18th, 2021
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 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. print(turtle.getFuelLevel())
  13. if turtle.getFuelLevel() < 200 then
  14. found = find("minecraft:coal")
  15. if found then
  16. turtle.select(found)
  17. turtle.refuel(4)
  18. end
  19. end
  20. end
  21.  
  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.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. while true do
  109. if x == 0 then break end
  110. walk(x)
  111. if x ~= 0 then x = x-1 end
  112. refuel()
  113. if y ~= 0 then y = y-1 end
  114. turtle.turnRight()
  115. if y == 0 then break end
  116. walk(y)
  117. turtle.turnRight()
  118.  
  119. end
  120.  
  121.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement