Advertisement
Fatherless

stripLeft

Dec 10th, 2024 (edited)
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.36 KB | None | 0 0
  1. --[[
  2.  
  3. This program is an alternate version of stripmine.lua meant to be used with another turtle.
  4. This one is responsible for making the left side of the strip mining tunnel
  5. stripRight.lua is responsible for the right side.
  6.  
  7. ]]
  8.  
  9. --[[ Constants ]]
  10. JUNK = {
  11.     "minecraft:cobbled_deepslate",
  12.     "minecraft:cobblestone",
  13.     "minecraft:tuff",
  14.     "minecraft:dirt",
  15.     "minecraft:gravel",
  16.     "minecraft:granite",
  17.     "minecraft:andesite",
  18.     "minecraft:diorite",
  19.     "minecraft:dripstone_block",
  20.     "minecraft:pointed_dripstone",
  21.     "minecraft:netherrack"
  22. }
  23.  
  24. --[[ Functions]]
  25.  
  26. local fwd = function ()
  27.     while not turtle.forward() do
  28.         turtle.dig()
  29.     end
  30.     turtle.digUp()
  31.     turtle.digDown()
  32. end
  33.  
  34. local function branchFwd()
  35.     while not turtle.forward() do
  36.         turtle.dig()
  37.     end
  38. end
  39.  
  40. local function branch() -- Digs one branch and returns to starting position
  41.     turtle.turnLeft()
  42.     for i = 1, 5 do
  43.         branchFwd()
  44.         turtle.digDown()
  45.     end
  46.     for i = 1, 5 do
  47.         turtle.back()
  48.     end
  49.     turtle.turnRight()
  50. end
  51.  
  52. local function dropJunk() -- Drops junk
  53.     for i = 1, 16 do
  54.         turtle.select(i)
  55.         if turtle.getItemCount() > 1 then
  56.             local name = turtle.getItemDetail()["name"]
  57.             for j = 1, #JUNK do
  58.                 if name == JUNK[j] then
  59.                     turtle.dropDown()
  60.                 end
  61.             end
  62.         end
  63.     end
  64. end
  65.  
  66. --[[ Main ]]
  67.  
  68. -- Check if the turtle has enough torches in slot 1
  69. if turtle.getItemDetail(1)["name"] ~= "minecraft:torch" then
  70.     print("Please place torches in slot 1 and try again")
  71.     return
  72. end
  73.  
  74. if turtle.getItemCount(1) < 32 then
  75.     print("Please place 32 torches in slot 1 and try again")
  76.     return
  77. end
  78.  
  79. if turtle.getFuelLevel() < 562 then
  80.     print("Please refuel to 562 and try again")
  81.     return
  82. end
  83.  
  84. -- Dig out the main tunnel
  85. fwd() -- First column of tunnel
  86. for i = 1, 124 do
  87.     fwd()
  88. end
  89.  
  90. dropJunk()
  91.  
  92. for i = 1, 124 do
  93.     turtle.back()
  94. end
  95.  
  96. -- Place torches
  97. turtle.select(1) -- Select the torches
  98.  
  99. turtle.placeUp() -- Place first torch
  100.  
  101. for i = 0, 124 do
  102.     if i % 4 == 0 then
  103.         turtle.placeUp()
  104.         if i ~= 0 then
  105.             branch()
  106.         end
  107.     end
  108.     if i ~= 124 then
  109.         fwd()
  110.     end
  111. end
  112.  
  113. dropJunk()
  114.  
  115. for i = 0, 124 do
  116.     turtle.back()
  117. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement