Blackhome

RefuelDigger

Jun 18th, 2025 (edited)
739
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | Gaming | 0 0
  1. -- pastebin get 180C8NRw RefuelDigger
  2.  
  3. local function isTurtleBlock(data)
  4.     return data and type(data.name) == "string" and data.name:match("computercraft:turtle")
  5. end
  6.  
  7. local function dropOffInventory(itemName)
  8.     for i = 1, 16 do
  9.         if turtle.getItemCount(i) > 0 then
  10.             if itemName then
  11.                 local data = turtle.getItemDetail(i)
  12.                 if data.name == itemName then
  13.                     turtle.select(i)
  14.                     turtle.drop()
  15.                 end
  16.             else
  17.                 turtle.select(i)
  18.                 turtle.drop()
  19.             end
  20.         end
  21.     end
  22. end
  23.  
  24. local cnt = 0
  25. while cnt < 4 do
  26.     local success, data = turtle.inspect()
  27.     if success and data.name == "minecraft:chest" then
  28.         turtle.turnLeft()
  29.         turtle.turnLeft()
  30.         break
  31.     end
  32.     turtle.turnLeft()
  33.     cnt = cnt + 1
  34. end
  35.  
  36. while true do
  37.     local success, data = turtle.inspect()
  38.     if success and isTurtleBlock(data) then
  39.         sleep(0.5)
  40.         turtle.dig()
  41.         turtle.turnLeft()
  42.         turtle.turnLeft()
  43.         dropOffInventory()
  44.         turtle.turnLeft()
  45.         turtle.turnLeft()
  46.     end
  47.     sleep(0.5)
  48. end
Advertisement
Add Comment
Please, Sign In to add comment