kd8lvt

chunkmine 1.0

Mar 15th, 2020
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local height = 67
  2. local width = 16
  3. function checkEC()
  4.   local dump = false
  5.   for i=3,16,1 do
  6.     turtle.select(i)
  7.        local stackSize = turtle.getItemCount()+turtle.getItemSpace()
  8.     local p = math.floor((turtle.getItemCount()/stackSize)*100)
  9.        if p >= 50 then
  10.       dump = true
  11.     end
  12.     if i == 16 and turtle.getItemCount() > 0 then
  13.       dump = true
  14.     end
  15.   end
  16.   if dump == true then
  17.     turtle.select(1)
  18.     turtle.digUp()
  19.     turtle.placeUp()
  20.     for i=3,16,1 do
  21.       turtle.select(i)
  22.       turtle.dropUp()
  23.     end
  24.     turtle.select(1)
  25.     turtle.digUp()
  26.   end
  27.   if turtle.getFuelLevel() < 1000 then
  28.     turtle.digUp()
  29.     turtle.select(2)
  30.     turtle.placeUp()
  31.     turtle.suckUp()
  32.     turtle.refuel()
  33.     turtle.digUp()
  34.   end
  35.   turtle.select(3)
  36. end
  37.  
  38. function mine()
  39.   while turtle.detect() do
  40.     turtle.dig()
  41.   end
  42. end
  43.  
  44. function move()
  45.   checkEC()
  46.   while turtle.detect() do
  47.     mine()
  48.   end
  49.   turtle.forward()
  50. end
  51.  
  52. function main()
  53.   for y=1,height-5,1 do
  54.     turtle.digDown()
  55.     turtle.down()
  56.     for x=1,width,1 do
  57.       for z=1,(width-1),1 do
  58.         move()
  59.       end
  60.       if x % 2 == 1 then
  61.         if x >= width then break end
  62.         turtle.turnLeft()
  63.         move()
  64.         turtle.turnLeft()
  65.       else
  66.         if x >= width then break end
  67.         turtle.turnRight()
  68.         move()
  69.         turtle.turnRight()
  70.       end
  71.     end
  72.     turtle.turnLeft()
  73.     for i=1,16,1 do
  74.       while not turtle.forward() do end
  75.     end
  76.     turtle.turnLeft()
  77.   end
  78. end
  79.  
  80. main()
Advertisement
Add Comment
Please, Sign In to add comment