Advertisement
TheDieselPunk

Export

Oct 4th, 2024 (edited)
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.63 KB | None | 0 0
  1. local meBridge = peripheral.find("meBridge")
  2. if not meBridge then
  3.     print("ME Bridge not found")
  4.     return
  5. end
  6.  
  7. -- List of mod IDs to export items from (updated list)
  8. local modList = {
  9.     "advancementframes", "advancementplaques", "ad_astra", "aether", "alexscaves", "alexsmobs", "allurement",
  10.     "ambientenvironment", "ambientsounds", "amendments", "appbot", "aquamirae", "arseng", "ars_creo", "ash_api",
  11.     "autumnity", "bagus_lib", "berry_good", "bcc", "betterdays", "betterf3", "betterjukebox", "betterlily",
  12.     "betterpingdisplay", "biomesoplenty", "blueprint", "boatload", "botania", "botarium", "buzzier_bees", "bwncr",
  13.     "carbonconfig", "carpeted", "carryon", "catalogue", "chalk", "charmofundying", "chat_heads", "cherishedworlds",
  14.     "chunkpregen", "chunksending", "citadel", "citresewn", "clayworks", "clean_tooltips", "cleardespawn", "clickadv",
  15.     "codechickenlib", "configured", "connectivity", "craterlib", "create", "createaddition", "create_jetpack",
  16.     "creativecore", "darkutils", "defaultoptions", "dimdoors", "drawerstooltip", "dusk", "dynview", "eatinganimation",
  17.     "eccentrictome", "ecologics", "eco", "elytraslot", "embeddium", "embeddiumextras", "embers", "enderstorage",
  18.     "enlightened_end", "everycomp", "fairylights", "fallingleaves", "fallingtree", "fancymenu", "farsight_view",
  19.     "farsightedmobs", "fastsuite", "flowerpatch", "fluxnetworks", "forgematica", "fpsreducer", "galosphere",
  20.     "gardens_of_the_dead", "globalpacks", "goblintraders", "guardvillagers", "hauntedharvest", "hearth_and_home",
  21.     "hunters_return", "immersiveengineering", "incubation", "inventoryhud", "inventorysorter", "jadeaddons",
  22.     "jadecolonies", "jeresources", "kiwi", "kleeslabs", "krypton", "kubejs_create", "kubejsarsnouveau", "kubejsdelight",
  23.     "kubejs_botania", "labels", "lapisreserve", "lightoverlay", "littlecontraptions", "littlelogistics", "lodestone",
  24.     "logprot", "lootintegrations", "lootjs", "mafglib", "malum", "mcjtylib", "mekanismadditions", "melody", "mowziesmobs",
  25.     "mutil", "neapolitan", "neat", "nethersdelight", "notenoughanimations", "obscure_api", "oculus", "openpartiesandclaims",
  26.     "paintings", "panoramica", "personality", "nourished_nether", "pigpen", "quark", "quarkoddities", "raised",
  27.     "rechiseledcreate", "recipeessentials", "refinedstorage", "refinedstorageaddons", "rftoolsbase", "ribbits",
  28.     "rightclickharvest", "runelic", "serverconfigupdater", "simplerpc", "sliceanddice", "smoothchunk", "snad",
  29.     "snowrealmagic", "snowundertrees", "sound_physics_remastered", "railways", "storagedrawers", "storageracks",
  30.     "structureessentials", "structure_gel", "sullysmod", "supplementaries", "suppsquared", "tetra", "tetracelium",
  31.     "tetranomicon", "textrues_embeddium_options", "conjurer_illager", "tipsmod", "toofast", "toolstats", "transparent",
  32.     "twigs", "twilightdelight", "twilightforest", "upgrade_aquatic", "valhelsia_furniture", "valhelsia_structures",
  33.     "valhelsia_tweaks", "visuality", "voicechat", "v_slab_compat", "woodworks", "xaeroworldmap", "xaerominimap",
  34.     "xercamusic", "xercapaint", "xnet", "xnetgases", "betterdeserttemples", "betterdungeons", "betterendisland",
  35.     "betterjungletemples", "betterfortresses", "betteroceanmonuments", "betterstrongholds", "zeta"
  36. }
  37.  
  38. -- Utility function to check if a value is in a table
  39. function table.contains(tbl, element)
  40.     for _, value in pairs(tbl) do
  41.         if value == element then
  42.             return true
  43.         end
  44.     end
  45.     return false
  46. end
  47.  
  48. -- Function to export items in batches
  49. local function exportAllItems()
  50.     local items = meBridge.listItems()
  51.  
  52.     if not items then
  53.         print("No items found in ME system.")
  54.         return
  55.     end
  56.  
  57.     for _, item in pairs(items) do
  58.         if item and item.name then
  59.             local mod = item.name:match("([^:]+)")
  60.             if mod and table.contains(modList, mod) then
  61.                 local countToExport = item.count or 64
  62.                 while countToExport > 0 do
  63.                     local batchCount = math.min(countToExport, 64)
  64.                     local success, err = pcall(function()
  65.                         meBridge.exportItem({name = item.name, count = batchCount}, "UP")
  66.                     end)
  67.                     if not success then
  68.                         print("Error exporting item " .. item.name .. ": " .. err)
  69.                         break
  70.                     end
  71.                     countToExport = countToExport - batchCount
  72.                 end
  73.             end
  74.         else
  75.             print("Invalid item detected, skipping...")
  76.         end
  77.     end
  78. end
  79.  
  80. -- Run the export function continuously
  81. while true do
  82.     exportAllItems()
  83. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement