Advertisement
ApparentlyChimp

Mine

Oct 23rd, 2021 (edited)
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.37 KB | None | 0 0
  1. -- TODOS:
  2. -- implementation of sand and gravel handling
  3.  
  4. -- digging a 3x3 area with a length of n blocks
  5. print("how far?")
  6. Length = tonumber(read())
  7.  
  8. while turtle.getFuelLevel() < Length * 5 do
  9.     print("not enough fuel")
  10.     sleep(2)
  11.     Fuel()
  12. end
  13.  
  14.  
  15. -- checking if the turtle has a chest in the last slot
  16. turtle.select(16)
  17. while true do
  18.     if turtle.getItemDetail() then
  19.         local item = turtle.getItemDetail()
  20.  
  21.         while item.name ~= "minecraft:chest" do
  22.             print("vanilla chest needed in last slot!")
  23.             sleep(5)
  24.         end
  25.  
  26.         break
  27.     else
  28.         print("vanilla chest needed in last slot!")
  29.         sleep(5)
  30.     end
  31. end
  32.  
  33.  
  34. -- checking if the turtle has enough torches in the second to last slot
  35. turtle.select(15)
  36. while true do
  37.     if turtle.getItemDetail() then
  38.         local item = turtle.getItemDetail()
  39.  
  40.         while item.name ~= "minecraft:torch" do
  41.             print("vanilla torches needed in second to last slot!")
  42.             sleep(5)
  43.         end
  44.  
  45.         if turtle.getItemCount() then
  46.             local itemCount = turtle.getItemCount()
  47.             local minTorches = Length / distanceTorches
  48.  
  49.             while itemCount < minTorches do
  50.                 print("not enough vanilla torches!")
  51.                 sleep(5)
  52.             end
  53.         end
  54.  
  55.         break
  56.     else
  57.         print("vanilla torches needed in second to last slot!")
  58.         sleep(5)
  59.     end
  60. end
  61.  
  62.  
  63. -- 3x3 area per block
  64. for i = 1, Length, 1 do
  65.     turtle.digUp()
  66.     turtle.digDown()
  67.     turtle.turnLeft()
  68.     turtle.dig()
  69.     turtle.forward()
  70.     turtle.digUp()
  71.     turtle.digDown()
  72.     turtle.turnRight()
  73.     turtle.turnRight()
  74.     turtle.forward()
  75.  
  76.     -- place a torch every 3rd block
  77.     if i % distanceTorches == 0 then
  78.         turtle.turnLeft()
  79.         turtle.turnLeft()
  80.         turtle.select(15)
  81.         turtle.place()
  82.         turtle.turnRight()
  83.         turtle.turnRight()
  84.     end
  85.  
  86.     turtle.dig()
  87.     turtle.forward()
  88.     turtle.digUp()
  89.     turtle.digDown()
  90.     turtle.turnRight()
  91.     turtle.turnRight()
  92.     turtle.forward()
  93.     turtle.turnRight()
  94.  
  95.  
  96.     if Length > i then
  97.         turtle.dig()
  98.         turtle.forward()
  99.     end
  100. end
  101.  
  102.  
  103. -- chest must be placed in 16th slot
  104. turtle.select(16)
  105. turtle.placeDown()
  106.  
  107.  
  108. for i = 1, 16, 1 do
  109.     turtle.select(i)
  110.     turtle.dropDown()
  111. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement