gelatine87 icon

apoteosisFilter

gelatine87 | PRO | 05/02/23 02:57:09 PM UTC | 0 ⭐ | 1266 👁️ | Never ⏰ | []
Lua |

2.12 KB

|

Gaming

|

0 👍

/

0 👎

-- find the RS Bridge peripheral START
local bridge = peripheral.find("rsBridge")
-- find the RS Bridge peripheral END
 
-- check if RS Bridge is connected START
if bridge == nil then
  print("RS Bridge not found.")
  return
end
-- check if RS Bridge is connected END
 
-- find the connected chest START
local chest = peripheral.find("ironchest:diamond_chest")
-- find the connected chest END
 
-- check if the chest is connected START
if chest == nil then
  print("Chest not found.")
  return
end
-- check if the chest is connected END
 
-- get all items in the RS network START
local items = bridge.listItems()
-- get all items in the RS network END
 
-- iterate over all items START
for _, item in ipairs(items) do  
  local itemInfo = bridge.getItem(item)  -- get information about the item
  if itemInfo.nbt ~= nil then 
    if itemInfo.nbt.Enchantments ~= nil then  -- check if item is enchanted
      print("Analyzing " .. itemInfo.displayName)  -- print the item being analyzed
      local count = bridge.exportItemToPeripheral(item, peripheral.getName(chest))  -- export the item to the chest
      if count > 0 then
        print("Exported " .. count .. " x " .. itemInfo.displayName .. " to " .. peripheral.getName(chest))
      end
    end
    if itemInfo.nbt.affix_data ~= nil then -- check if item has affixes
      print("Analyzing " .. itemInfo.displayName)  -- print the item being analyzed
      local count = bridge.exportItemToPeripheral(item, peripheral.getName(chest))  -- export the item to the chest
      if count > 0 then
        print("Exported " .. count .. " x " .. itemInfo.displayName .. " to " .. peripheral.getName(chest))
      end
    end
    if itemInfo.nbt.gem ~= nil then -- check if item has gem
      print("Analyzing " .. itemInfo.displayName)  -- print the item being analyzed
      local count = bridge.exportItemToPeripheral(item, peripheral.getName(chest))  -- export the item to the chest
      if count > 0 then
        print("Exported " .. count .. " x " .. itemInfo.displayName .. " to " .. peripheral.getName(chest))
      end
    end
  end
end
-- iterate over all items END

Comments