Advertisement
WildBeastPT

Wild Mining Turtle

Jun 10th, 2023
1,326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.23 KB | None | 0 0
  1. local SLOT_COUNT = 16
  2. local CHUNK_SIDE = 8
  3.  
  4. function storeAll()
  5.     for slot = 1, SLOT_COUNT, 1 do
  6.         item = turtle.getItemDetail(slot)
  7.         if(item ~= nil) then
  8.             if(item["name"] == "minecraft:chest") then
  9.                 turtle.select(slot)
  10.                 turtle.placeUp()
  11.                 for slot = 1, SLOT_COUNT, 1 do
  12.                     item = turtle.getItemDetail(slot)
  13.                     if(item ~= nil) then
  14.                         if((item["name"] ~= "minecraft:coal") and (item["name"] ~= "minecraft:chest")) then
  15.                             turtle.select(slot)
  16.                             turtle.dropUp()
  17.                         end
  18.                     end
  19.                 end
  20.                 return true
  21.             end
  22.         end
  23.     end
  24.     return false
  25. end
  26.  
  27. function checkFuel()
  28.     if(turtle.getFuelLevel() < 50) then
  29.         for slot = 1, SLOT_COUNT, 1 do
  30.             item = turtle.getItemDetail(slot)
  31.             if(item ~= nil) then
  32.                 if(item["name"] == "minecraft:coal") then
  33.                     turtle.select(slot)
  34.                     turtle.refuel(1)
  35.                     return true
  36.                 end
  37.             end
  38.         end
  39.         return false
  40.     end
  41.     return true
  42. end
  43.  
  44. function chunkDig()
  45.     success, data = turtle.inspectDown()
  46.     while(data.name ~= "minecraft:bedrock") do
  47.         checkFuel()
  48.         for times = 1, 4, 1 do
  49.             for block = 2, 8, 1 do
  50.                 turtle.dig()
  51.                 turtle.forward()
  52.             end
  53.             turtle.turnRight()
  54.             turtle.dig()
  55.             turtle.forward()
  56.             turtle.turnRight()
  57.             for block = 2, 8, 1 do
  58.                 turtle.dig()
  59.                 turtle.forward()
  60.             end
  61.             turtle.turnLeft()
  62.             turtle.dig()
  63.             turtle.forward()
  64.             turtle.turnLeft()
  65.             checkFuel()
  66.         end
  67.         turtle.turnLeft()
  68.         for block = 1, 8, 1 do
  69.             turtle.forward()
  70.         end
  71.         turtle.turnRight()
  72.         turtle.digDown()
  73.         turtle.down()
  74.         storeAll()
  75.         success, data = turtle.inspectDown()
  76.     end
  77.     return true
  78. end
  79.  
  80. function main()
  81.     return chunkDig()
  82. end
  83.  
  84. main()
  85.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement