Advertisement
Guest User

mine

a guest
Jul 12th, 2018
333
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. function checkFuel()
  2.  
  3. currentFuel = turtle.getFuelLevel()
  4. currentSlot = turtle.getSelectedSlot()
  5.  
  6. if turtle.getFuelLevel() < 1 then
  7.   for slot = 1,16 do
  8.     if turtle.refuel() then
  9.       return true, "Fueled"
  10.         elseif slot == 16 then
  11.           return false, "No fuel left"
  12.           end
  13.        end
  14.     else
  15.       print("there is still "..currentFuel.." Fuel left")
  16.       return false
  17.   end
  18. end
  19.  
  20. function isValuable()
  21. local isValuable = true
  22.  
  23. succes, data = turtle.inspect()
  24.  
  25.   if data["name"] == "minecraft:grass" or data.name == "minecraft:stone" or data.name == "minecraft:cobblestone" or data.name == "minecraft:dirt" or turtle.detect() == false then
  26.     isValuable = false
  27.   else
  28.     isValuable = true
  29.   end  
  30.  
  31. return isValuable
  32. end
  33.  
  34. function checkWalls()
  35.  
  36.   for checking = 1,4 do
  37.     if isValuable() == true then
  38.       turtle.dig()
  39.     end
  40.     turtle.turnRight()
  41.   end
  42.  
  43. end  
  44.  
  45. function printinv()
  46.  
  47. print("Printing the inventory: ")
  48.  
  49. currentSlot = turtle.getSelectedSlot()
  50.      
  51. for slot = 1,16 do
  52.   turtle.select(slot)
  53.   data = turtle.getItemDetail()
  54.     if data then
  55.      print("slot "..slot.." has "..data.count.." "..data.name)
  56.     else
  57.       print("slot "..slot.." has no items")      
  58.    end  
  59.   end
  60. turtle.select(currentSlot)
  61. end  
  62.                                    
  63. depth = 0
  64.  
  65. checkFuel()
  66.  
  67. turtle.digDown()
  68.  
  69.   while turtle.detectDown() == false do
  70.     if turtle.down() then
  71.       depth = depth + 1
  72.       print("I am "..depth.." levels deep")
  73.     end
  74.    checkFuel()
  75.    checkWalls()
  76.    succes, data = turtle.inspect()
  77.      if not turtle.digDown() and data.name == "minecraft:bedrock" then
  78.      break
  79.     end  
  80.   end
  81.  
  82.  checkFuel()
  83.   for surface = 1,depth do
  84.    turtle.up()
  85.   if surface == depth then
  86.     turtle.placeDown()
  87.   end
  88.  end
  89. printinv()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement