Advertisement
Letharg

Untitled

Mar 30th, 2020
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.76 KB | None | 0 0
  1. depth = 150
  2. valuable = {"minecraft:torch", "minecraft:diamond", "minecraft:iron_ore", "minecraft:lapis_lazuli", "minecraft:coal", "minecraft:gold_ore", "minecraft:redstone"}
  3. garbage_interval = 30
  4. torch_interval = 16
  5. torch_slot = 2
  6.  
  7. function emptyIntoChest()
  8.     for i = 1, 16 do
  9.         turtle.select(i)
  10.         turtle.drop()
  11.     end
  12. end
  13.  
  14. function deleteGarbage()
  15.     for i = 1,16 do
  16.         turtle.select(i)
  17.         data = turtle.getItemDetail()
  18.         if data ~= nil then
  19.             name = data["name"]
  20.             keep = true
  21.  
  22.             if keep == false then
  23.                 turtle.dropDown()
  24.                 print("dropping item" .. name)
  25.             end
  26.         end
  27.     end
  28. end
  29.  
  30. function placeTorch()
  31.     turtle.down()
  32.     turtle.select(torch_slot)
  33.     turtle.back()
  34.     turtle.back()
  35.     turtle.place()
  36.     turtle.up()
  37.     turtle.forward()
  38.     turtle.forward()
  39. end
  40.  
  41.  
  42.  
  43. if turtle.getFuelLevel() < 350 then
  44.     turtle.select(1)
  45.     turtle.refuel()
  46. end
  47.  
  48. if turtle.getFuelLevel() < 350 then
  49.     print("refuel not succesful")
  50.     error()
  51. end
  52.  
  53. function checkTorches()
  54.     turtle.select(torch_slot)
  55.     torch_count = turtle.getItemCount()
  56.     if torch_count < depth/torch_interval then
  57.         print("not enough torches")
  58.     end
  59. end
  60.  
  61.  
  62. for a=1,depth do
  63.  
  64.     turtle.dig()
  65.     turtle.forward()
  66.     turtle.digUp()
  67.     turtle.digDown()
  68.    
  69.     if a%garbage_interval == 0 then
  70.         deleteGarbage()
  71.     end
  72.    
  73.     if a%torch_interval == 0 then
  74.         placeTorch()
  75.     end
  76.    
  77. end
  78.  
  79. for a=1, depth do
  80.     turtle.back()
  81. end
  82.  
  83. turtle.turnLeft()
  84. turtle.turnLeft()
  85.  
  86. if turtle.detect() then
  87.     -- chest exists
  88.     print("chest found")
  89.     emptyIntoChest()
  90. end
  91.  
  92. print(tostring(turtle.getFuelLevel()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement