Advertisement
Fatherless

stripRight

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 right side of the strip mining tunnel
  5. stripLeft.lua is responsible for the left 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.  
  25. --[[ Functions ]]
  26.  
  27. local fwd = function ()
  28.     while not turtle.forward() do
  29.         turtle.dig()
  30.     end
  31.     turtle.digUp()
  32.     turtle.digDown()
  33. end
  34.  
  35. local function branchFwd()
  36.     while not turtle.forward() do
  37.         turtle.dig()
  38.     end
  39. end
  40.  
  41. local function branch() -- Digs one branch and returns to starting position
  42.     turtle.turnRight()
  43.     for i = 1, 5 do
  44.         branchFwd()
  45.         turtle.digDown()
  46.     end
  47.     for i = 1, 5 do
  48.         turtle.back()
  49.     end
  50.     turtle.turnLeft()
  51. end
  52.  
  53. local function dropJunk() -- Drops junk
  54.     for i = 1, 16 do
  55.         turtle.select(i)
  56.         if turtle.getItemCount() > 1 then
  57.             local name = turtle.getItemDetail()["name"]
  58.             for j = 1, #JUNK do
  59.                 if name == JUNK[j] then
  60.                     turtle.dropDown()
  61.                 end
  62.             end
  63.         end
  64.     end
  65. end
  66.  
  67. --[[ Main ]]
  68.  
  69. -- Check if the turtle has enough torches in slot 1
  70. if turtle.getItemDetail(1)["name"] ~= "minecraft:torch" then
  71.     print("Please place torches in slot 1 and try again")
  72.     return
  73. end
  74.  
  75. if turtle.getItemCount(1) < 32 then
  76.     print("Please place 32 torches in slot 1 and try again")
  77.     return
  78. end
  79.  
  80. if turtle.getFuelLevel() < 562 then
  81.     print("Please refuel to 562 and try again")
  82.     return
  83. end
  84.  
  85. -- Dig out the main tunnel
  86. fwd() -- First column of tunnel
  87. for i = 1, 124 do
  88.     fwd()
  89. end
  90.  
  91. dropJunk()
  92.  
  93. for i = 1, 124 do
  94.     turtle.back()
  95. end
  96.  
  97. -- Place torches
  98. turtle.select(1) -- Select the torches
  99.  
  100. turtle.placeUp() -- Place first torch
  101.  
  102. for i = 0, 124 do
  103.     if i % 4 == 0 then
  104.         turtle.placeUp()
  105.         if i ~= 0 then
  106.             branch()
  107.         end
  108.     end
  109.     if i ~= 124 then
  110.         fwd()
  111.     end
  112. end
  113.  
  114. dropJunk()
  115.  
  116.  
  117. for i = 0, 124 do
  118.     turtle.back()
  119. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement