temposabel

Untitled

Dec 17th, 2021 (edited)
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. size = 8
  2.  
  3. function tablelength(T)
  4.     local count = 0
  5.     for _ in pairs(T) do count = count + 1 end
  6.     return count
  7.   end
  8.  
  9.  
  10. function refuel()
  11.     for i = 1,16 do
  12.     turtle.select(i)
  13.     print(turtle.getFuelLevel())
  14.     if turtle.getFuelLevel() < 200 then
  15.         turtle.refuel(10)
  16.     end
  17. end
  18. end
  19.  
  20. intebajs = {'minecraft:diamond', 'minecraft:iron_ore', 'minecraft:gold_ore', 'minecraft:emerald', 'minecraft:obsidian', 'minecraft:coal'}
  21.  
  22. function in_list (tab, val)
  23.     for index, value in ipairs(tab) do
  24.         if value == val then
  25.             return true
  26.         end
  27.     end
  28.  
  29.     return false
  30. end
  31.  
  32. function throw_shit()
  33.     for i = 1,16 do
  34.         turtle.select(i)
  35.         sname = turtle.getItemDetail()
  36.         if sname then
  37.             print(in_list(intebajs,sname.name))
  38.             if not in_list(intebajs,sname.name) 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. 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