Advertisement
Bubbs

mine.lua

Nov 24th, 2020 (edited)
636
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.76 KB | None | 0 0
  1. local args = {...}
  2.  
  3. local blocks = args[1]
  4.  
  5. function checkForLava(direction)
  6.     if direction == "up" then
  7.         local success, data = turtle.inspectUp()
  8.         if success then
  9.             if data.name == "minecraft:lava" or data.name == "minecraft:flowing_lava" then
  10.                 turtle.place()
  11.             end
  12.         end
  13.     elseif direction == "down" then
  14.         local success, data = turtle.inspectUp()
  15.         if success then
  16.             if data.name == "minecraft:lava" or data.name == "minecraft:flowing_lava" then
  17.                 turtle.place()
  18.             end
  19.         end
  20.     elseif direction == "front" then        
  21.         local success, data = turtle.inspect()
  22.         if success then
  23.             if data.name == "minecraft:lava" or data.name == "minecraft:flowing_lava" then
  24.                 turtle.place()
  25.             end
  26.         end
  27.     end
  28. end
  29.  
  30. function refuel()
  31.     for i = 1, 16 do
  32.         turtle.select(i)
  33.         if turtle.getItemDetail() then
  34.             local slot = turtle.getItemDetail()
  35.             if slot.name == "minecraft:coal" then
  36.                 turtle.refuel()
  37.                 break
  38.             end
  39.         end
  40.     end
  41. end
  42.  
  43. function checkLeftRight()
  44.     turtle.turnLeft()
  45.     checkForLava("front")
  46.     turtle.turnRight()
  47.     turtle.turnRight()
  48.     checkForLava("front")
  49.     turtle.turnLeft()
  50. end
  51.  
  52. for i = 1, blocks do
  53.     refuel()
  54.     if turtle.detect() then
  55.         turtle.dig()
  56.     end
  57.     turtle.forward()
  58.     if turtle.detectUp() then
  59.         turtle.digUp()
  60.     end
  61.     if turtle.detectDown() then
  62.         turtle.digDown()
  63.     end
  64.     checkLeftRight()
  65.     turtle.down()
  66.     checkLeftRight()
  67.     checkForLava("down")
  68.     turtle.up()
  69.     turtle.up()
  70.     checkLeftRight()
  71.     turtle.down()
  72. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement