Advertisement
adriannic

VeinMinerBasedMiner

Dec 30th, 2021
1,361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.27 KB | None | 0 0
  1. --[[
  2. length = 1 for normal veinMiner
  3. ]]--
  4. local tArgs = {...}
  5.  
  6. local length = 32
  7.  
  8. if #tArgs >= 1 and tonumber(tArgs[1]) then
  9.     length = tonumber(tArgs[1])
  10. end
  11.  
  12. -- Block Whitelist --
  13.  
  14. local whitelist = {
  15.     ["minecraft:gold_ore"] = true,
  16.     ["minecraft:iron_ore"] = true,
  17.     ["minecraft:coal_ore"] = true,
  18.     ["minecraft:lapis_ore"] = true,
  19.     ["minecraft:diamond_ore"] = true,
  20.     ["minecraft:lit_redstone_ore"] = true,
  21.     ["minecraft:redstone_ore"] = true,
  22.     ["minecraft:emerald_ore"] = true,
  23.     ["minecraft:quartz_ore"] = true,
  24.     ["minecraft:glowstone"] = true,
  25.     ["ic2:resource"] = true
  26. }
  27.  
  28. local function veinMiner()
  29.     -- Check fuel --
  30.     local fuel = turtle.getFuelLevel()
  31.     if fuel ~= "unlimited" and fuel < 10 then
  32.         print("Insert fuel")
  33.         while fuel < 10 do
  34.             for i=1, 16 do
  35.                 turtle.select(i)
  36.                 turtle.refuel()
  37.             end
  38.         end
  39.         print("Done refueling")
  40.     end
  41.     -- Program --
  42.     if turtle.detectUp() and whitelist[select(2,turtle.inspectUp()).name] then
  43.         while not turtle.up() do
  44.             turtle.digUp()
  45.         end
  46.         veinMiner()
  47.         while not turtle.down() do
  48.             turtle.digDown()
  49.         end
  50.     end
  51.     if turtle.detectDown() and whitelist[select(2,turtle.inspectDown()).name] then
  52.         turtle.digDown()
  53.         turtle.down()
  54.         veinMiner()
  55.         while not turtle.up() do
  56.             turtle.digUp()
  57.         end
  58.     end
  59.     for _=1, 4 do
  60.         if turtle.detect() and whitelist[select(2,turtle.inspect()).name] then
  61.             while not turtle.forward() do
  62.                 turtle.dig()
  63.                 sleep(.5)
  64.             end
  65.             veinMiner()
  66.             if not turtle.back() then
  67.                 turtle.turnLeft()
  68.                 turtle.turnLeft()
  69.                 while not turtle.forward() do
  70.                     turtle.dig()
  71.                 end
  72.                 turtle.turnLeft()
  73.                 turtle.turnLeft()
  74.             end
  75.         end
  76.         turtle.turnLeft()
  77.     end
  78. end
  79.  
  80. local function clear()
  81.     for i=1, 16 do
  82.         turtle.select(i)
  83.         if turtle.getItemCount() > 0 then
  84.             name = turtle.getItemDetail().name
  85.         else
  86.             name = ""
  87.         end
  88.         if name == "minecraft:cobblestone" or name == "minecraft:gravel" or name == "minecraft:sand" or name == "minecraft:flint" then
  89.             turtle.drop()
  90.         end
  91.     end
  92.     turtle.select(1)
  93. end
  94.  
  95. -- Code --
  96.  
  97. if not os.getComputerLabel() then
  98.     os.setComputerLabel("miner")
  99. end
  100.  
  101. clear()
  102.  
  103. for _=1, length do
  104.     while not turtle.forward() do
  105.         turtle.dig()
  106.         sleep(.5)
  107.     end
  108.     veinMiner()
  109.     clear()
  110. end
  111. for _=1, length do
  112.     turtle.back()
  113. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement