Advertisement
temposabel

Untitled

Dec 17th, 2021
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.86 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.     local d = {}
  46.     for i = 1,16 do
  47.     turtle.select(i)
  48.     sname = turtle.getItemDetail()
  49.     if sname then
  50.     sname = sname.name
  51.     if name == sname
  52.     then
  53.         d[tablelength(d)+1] = i end
  54.     end
  55. end
  56.     if tablelength(d) ~= 0 then return d[1]
  57.     else return false
  58.     end
  59. end
  60. function mine()
  61.     turtle.dig()
  62.     turtle.digUp()
  63.     if turtle.inspectDown() then else
  64.         if turtle.getItemCount() == 0 then
  65.             local slot = find("minecraft:cobblestone")
  66.             if not slot then
  67.                 local slot = find("minecraft:netherrack")
  68.             end
  69.             turtle.placeDown()
  70.         end
  71.     end
  72.     suc = turtle.forward()
  73.     return suc
  74. end
  75.  
  76. function walk (len)
  77.     x = 0
  78.     while x < len do
  79.         if mine() then x = x + 1 end
  80.     end
  81. end
  82.  
  83. function walknbuild (len)
  84.     x = 0
  85.     while x < len do
  86.         if mine() then x = x + 1 end
  87.     end
  88. end
  89.  
  90. walknbuild(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement