Advertisement
gelatine87

apoteosisFilter

May 2nd, 2023
915
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.12 KB | Gaming | 0 0
  1. -- find the RS Bridge peripheral START
  2. local bridge = peripheral.find("rsBridge")
  3. -- find the RS Bridge peripheral END
  4.  
  5. -- check if RS Bridge is connected START
  6. if bridge == nil then
  7.   print("RS Bridge not found.")
  8.   return
  9. end
  10. -- check if RS Bridge is connected END
  11.  
  12. -- find the connected chest START
  13. local chest = peripheral.find("ironchest:diamond_chest")
  14. -- find the connected chest END
  15.  
  16. -- check if the chest is connected START
  17. if chest == nil then
  18.   print("Chest not found.")
  19.   return
  20. end
  21. -- check if the chest is connected END
  22.  
  23. -- get all items in the RS network START
  24. local items = bridge.listItems()
  25. -- get all items in the RS network END
  26.  
  27. -- iterate over all items START
  28. for _, item in ipairs(items) do  
  29.   local itemInfo = bridge.getItem(item)  -- get information about the item
  30.   if itemInfo.nbt ~= nil then
  31.     if itemInfo.nbt.Enchantments ~= nil then  -- check if item is enchanted
  32.       print("Analyzing " .. itemInfo.displayName)  -- print the item being analyzed
  33.       local count = bridge.exportItemToPeripheral(item, peripheral.getName(chest))  -- export the item to the chest
  34.       if count > 0 then
  35.         print("Exported " .. count .. " x " .. itemInfo.displayName .. " to " .. peripheral.getName(chest))
  36.       end
  37.     end
  38.     if itemInfo.nbt.affix_data ~= nil then -- check if item has affixes
  39.       print("Analyzing " .. itemInfo.displayName)  -- print the item being analyzed
  40.       local count = bridge.exportItemToPeripheral(item, peripheral.getName(chest))  -- export the item to the chest
  41.       if count > 0 then
  42.         print("Exported " .. count .. " x " .. itemInfo.displayName .. " to " .. peripheral.getName(chest))
  43.       end
  44.     end
  45.     if itemInfo.nbt.gem ~= nil then -- check if item has gem
  46.       print("Analyzing " .. itemInfo.displayName)  -- print the item being analyzed
  47.       local count = bridge.exportItemToPeripheral(item, peripheral.getName(chest))  -- export the item to the chest
  48.       if count > 0 then
  49.         print("Exported " .. count .. " x " .. itemInfo.displayName .. " to " .. peripheral.getName(chest))
  50.       end
  51.     end
  52.   end
  53. end
  54. -- iterate over all items END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement