MtnMCG

AdvancedMine

Jul 21st, 2024
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | Gaming | 0 0
  1. local function selectTorch()
  2.     for slot = 1, 16 do
  3.         local item = turtle.getItemDetail(slot)
  4.         if item and item.name == "minecraft:torch" then
  5.             turtle.select(slot)
  6.             return true
  7.         end
  8.     end
  9.     return false
  10. end
  11.  
  12. local function placeTorch()
  13.     if selectTorch() then
  14.         turtle.placeUp()
  15.     end
  16. end
  17.  
  18. local function mineForward()
  19.     turtle.dig()
  20.     turtle.forward()
  21.     turtle.digUp()
  22. end
  23.  
  24. local function stripMine(length)
  25.     for i = 1, length do
  26.         mineForward()
  27.         if i % 5 == 0 then
  28.             turtle.turnLeft()
  29.             turtle.turnLeft()
  30.             placeTorch()
  31.             turtle.turnRight()
  32.             turtle.turnRight()
  33.         end
  34.     end
  35. end
  36.  
  37. local function main()
  38.     print("Enter the length of the strip mine:")
  39.     local length = tonumber(io.read())
  40.     stripMine(length)
  41.     print("Mining complete!")
  42. end
  43.  
  44. main()
Advertisement
Add Comment
Please, Sign In to add comment