Advertisement
Guest User

mine.lua

a guest
Dec 14th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. junk = {"granite","andesite","dirt", "stone","gravel","diorite", "grass_block"}
  2.  
  3.  
  4. function valueable()
  5.   if (turtle.inspect()) then
  6.     local success, data = turtle.inspect()
  7.     isJunk = true
  8.     for keys, value in pairs(junk) do
  9.         if (data.name == "minecraft:"..junk[keys]) then
  10.           isJunk = false
  11.         end
  12.     end
  13.   end
  14.   return isJunk
  15. end
  16.  
  17. function checkWalls()
  18.   for i = 1, 4 do
  19.     if (valueable()) then
  20.       turtle.dig()
  21.     end
  22.     turtle.turnRight()
  23.   end
  24. end
  25.  
  26. function mine()
  27.   depth = 0
  28.   while turtle.digDown() do
  29.     turtle.down()
  30.     depth = depth + 1
  31.     checkWalls()
  32.   end
  33.  
  34.   for i = 1, depth do
  35.     turtle.up()
  36.   end
  37.   turtle.select(16)
  38.   turtle.placeDown()
  39. end
  40.  
  41. function pathing()
  42.   turtle.turnRight()
  43.   turtle.dig()
  44.   turtle.forward()
  45.   turtle.dig()
  46.   turtle.forward()
  47.   turtle.turnLeft()
  48.   turtle.dig()
  49.   turtle.forward()
  50. end
  51.  
  52. function organize()
  53.   inventory = {}
  54.  
  55.   for i = 3,16 do
  56.     if (turtle.getItemDetail(i)) then
  57.       data = turtle.getItemDetail(i)
  58.       data["slot"] = i
  59.     end
  60.   end
  61. end
  62.  
  63. function main()
  64.   while true do
  65.     pathing()
  66.     mine()
  67.   end
  68. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement