Advertisement
HNO3

Simple mining Drill revisited

Aug 23rd, 2016
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- pastebin get dNmedzr3 drill
  2. -- pastebin run dNmedzr3
  3. function dig()
  4.     return turtle.dig()
  5. end
  6.  
  7. local blacklist = {
  8.   "minecraft:stone",
  9.   "minecraft:cobblestone",
  10.   "minecraft:dirt",
  11.   "minecraft:grass",
  12.   -- and so on
  13. }
  14. local _blist = {}
  15.  
  16. local firsthit = false
  17. local fill = 0
  18. local drill = true
  19. local depth = 0
  20.  
  21. -- Inverse blacklist for fast hashmap lookup
  22. for i = 1, #blacklist do
  23.   _blist[blacklist[i]] = true
  24. end
  25.  
  26.  
  27. while drill do
  28.     turtle.select(2)
  29.     temp, data = turtle.inspectDown()
  30.     if data.name == "minecraft:bedrock" then
  31.         for i=0,depth-1 do
  32.             turtle.up()
  33.             if i >= (depth - (fill)) then
  34.                 turtle.select(2)
  35.                 turtle.placeDown()
  36.             end
  37.         end
  38.         drill = false
  39.     else
  40.         if not turtle.detectDown() then
  41.             if not firsthit then
  42.                 firsthit=true
  43.                 fill = depth + 1
  44.             end
  45.         end
  46.         turtle.digDown()
  47.         if turtle.down() then depth = depth + 1 end
  48.         for j=1,4 do
  49.             temp, block = turtle.inspect()
  50.             if _blist[block["name"]] then
  51.                 --do nothing
  52.             else
  53.                 dig()
  54.             end
  55.             turtle.turnLeft()
  56.         end
  57.     end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement