Advertisement
Fatherless

stripmine

Dec 6th, 2024 (edited)
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. -- This prepares a 2 x 3 tunnel for strip mining
  2.  
  3. -- Check if the turtle has enough torches in slot 1
  4. if turtle.getItemDetail(1)["name"] ~= "minecraft:torch" then
  5.     print("Please place torches in slot 1 and try again")
  6.     return
  7. end
  8.  
  9. if turtle.getItemCount(1) < 64 then
  10.     print("Please place 64 torches in slot 1 and try again")
  11.     return
  12. end
  13.  
  14. if turtle.getFuelLevel() < 1123 then
  15.     print("Please refuel to 1123 and try again")
  16.     return
  17. end
  18.  
  19. -- Functions
  20.  
  21. local fwd = function ()
  22.     while not turtle.forward() do
  23.         turtle.dig()
  24.     end
  25.     turtle.digUp()
  26.     turtle.digDown()
  27. end
  28.  
  29. local function branchFwd()
  30.     while not turtle.forward() do
  31.         turtle.dig()
  32.     end
  33. end
  34.  
  35. local function branch() -- Digs one branch and returns to starting position
  36.     turtle.turnLeft()
  37.     for i = 1, 5 do
  38.         branchFwd()
  39.         turtle.digDown()
  40.     end
  41.     for i = 1, 5 do
  42.         turtle.back()
  43.     end
  44.     turtle.turnRight()
  45. end
  46.  
  47.  
  48. -- Dig out the main tunnel
  49.  
  50. fwd() -- First column of tunnel
  51. for i = 0, 124 do
  52.     fwd()
  53. end
  54. turtle.turnRight()
  55. fwd()
  56. turtle.turnRight()
  57. for i = 0, 124 do
  58.     fwd()
  59. end
  60.  
  61. -- Place torches
  62. turtle.select(1) -- Select the torches
  63.  
  64. turtle.turnRight() -- Get back to starting position
  65. fwd()
  66. turtle.turnRight()
  67.  
  68. turtle.placeUp() -- Place first torch
  69.  
  70. for i = 0, 124 do
  71.     if i % 4 == 0 then
  72.         turtle.placeUp()
  73.         if i ~= 0 then
  74.             branch()
  75.         end
  76.     end
  77.     if i ~= 124 then
  78.         fwd()
  79.     end
  80. end
  81.  
  82. turtle.turnRight()
  83. fwd()
  84. turtle.turnRight()
  85.  
  86. turtle.placeUp()
  87.  
  88. for i = 0, 124 do
  89.     if i % 4 == 0 then
  90.         turtle.placeUp()
  91.         if i ~= 124 then
  92.             branch()
  93.         end
  94.     end
  95.     fwd()
  96. end
  97.  
  98.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement