Advertisement
temposabel

Untitled

Dec 17th, 2021 (edited)
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1.  
  2. size = 10
  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.             if not in_list(intebajs,sname) then turtle.dropDown() end
  39.         end
  40.     end
  41. end
  42.  
  43. function find(name)
  44.     local d = {}
  45.     for i = 1,16 do
  46.     turtle.select(i)
  47.     sname = turtle.getItemDetail()
  48.     if sname then
  49.     sname = sname.name
  50.     if name == sname
  51.     then
  52.         d[tablelength(d)+1] = i end
  53.     end
  54. end
  55.     return d
  56. end
  57.  
  58. function mine()
  59.     turtle.dig()
  60.     turtle.digUp()
  61.     turtle.digDown()
  62.     suc = turtle.forward()
  63.     return suc
  64. end
  65.  
  66. function walk (len)
  67.     x = 0
  68.     while x < len do
  69.         if mine() then x = x + 1 end
  70.     end
  71. end
  72.  
  73.  
  74.  
  75. for i = 0,size do
  76.     walk(size - i)
  77.     refuel()
  78.     turtle.turnRight()
  79.     throw_shit()
  80.     walk(size - i)
  81.     turtle.turnRight()
  82.     throw_shit()
  83. end
  84.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement