Radray

ChunkMining

Jun 23rd, 2021 (edited)
755
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.44 KB | None | 0 0
  1. local StarterDepth = 8
  2. local Length = 3
  3. local Width = 1
  4.  
  5. local Depth = 2
  6.  
  7. local DigUp = turtle.digUp
  8. local DigDown = turtle.digDown
  9. local Left = turtle.turnLeft
  10. local Right = turtle.turnRight
  11.  
  12.  
  13. local function InventoryCleanup(force)
  14.  
  15.     if turtle.getItemDetail(16) or force then
  16.         turtle.select(1)
  17.         turtle.placeUp()
  18.         for i = 2, 16 do
  19.             turtle.select(i)
  20.             turtle.dropUp()
  21.         end
  22.     end
  23.    
  24.     turtle.select(1)
  25.     DigUp()
  26.        
  27. end
  28.  
  29.  
  30. local function Forward()
  31.  
  32.     DigUp()
  33.     InventoryCleanup()
  34.     DigDown()
  35.  
  36.     while not turtle.forward() do
  37.         turtle.dig()
  38.     end
  39.    
  40. end
  41.  
  42.  
  43. local function Down()
  44.  
  45.     DigDown()
  46.    
  47.     if not turtle.down() then
  48.         return false
  49.     else
  50.         Depth = Depth + 1
  51.         return true
  52.     end
  53.    
  54. end
  55.  
  56. local Laps = Width*8
  57. local ReturnWidth = Width*16-1
  58. local LapLength = Length*16-2
  59.  
  60.  
  61.  
  62. for i = 1, StarterDepth do
  63.     Down()
  64. end
  65.  
  66.  
  67. Forward()
  68.  
  69. while true do
  70.     for i = 1, Laps do
  71.  
  72.         for i = 1, LapLength do
  73.             Forward()
  74.         end
  75.  
  76.         Right()
  77.         Forward()
  78.         Right()
  79.  
  80.         for i = 1, LapLength do
  81.             Forward()
  82.         end
  83.  
  84.         if (i == Laps) then
  85.             Forward()
  86.             Right()
  87.             for i = 1, ReturnWidth do
  88.                 Forward()
  89.             end
  90.             Right()
  91.            
  92.             DigDown()
  93.             Down()
  94.             DigDown()
  95.             if not Down() then
  96.                 InventoryCleanup()
  97.                 for i = 1, Depth do
  98.                     turtle.up()
  99.                 end
  100.                 InventoryCleanup(true)
  101.                 exit()
  102.             end
  103.             DigDown()
  104.             Down()
  105.             Forward()
  106.            
  107.         else
  108.             Left()
  109.             Forward()
  110.             Left()
  111.         end
  112.     end
  113. end
  114.    
Add Comment
Please, Sign In to add comment