Advertisement
gongitompie

Untitled

Aug 20th, 2023
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. -- Set the AE2 network controller's address
  2. local ae2ControllerAddress = "your_ae2_controller_address_here"
  3.  
  4. -- Open a connection to the AE2 network controller
  5. local ae2Controller = peripheral.wrap(ae2ControllerAddress)
  6.  
  7. -- Retrieve a list of all connected storage cells
  8. local storageCells = ae2Controller.getStorageCells()
  9.  
  10. -- Initialize a table to store the unique ores
  11. local uniqueOres = {}
  12.  
  13. -- Iterate through each storage cell
  14. for _, storageCell in pairs(storageCells) do
  15. -- Retrieve the list of items stored in the storage cell
  16. local storedItems = storageCell.getItems()
  17.  
  18. -- Iterate through each stored item
  19. for _, item in pairs(storedItems) do
  20. local itemDisplayName = item.getItemStack().getDisplayName()
  21.  
  22. -- Check if the item is an ore by checking its display name
  23. if itemDisplayName:match("Ore") then
  24. uniqueOres[itemDisplayName] = true
  25. end
  26. end
  27. end
  28.  
  29. -- Print out the list of unique ores
  30. print("List of Ores in AE2 Network:")
  31. for oreName, _ in pairs(uniqueOres) do
  32. print("- " .. oreName)
  33. end
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement