Skip to content

How do I handle the contents of a registry? #1812

Discussion options

You must be logged in to vote

A simple approach is

// Iterate over existing entries and perform action                            
for (Entry<RegistryKey<Item>, Item> entry : Registry.ITEM.getEntries())        
{                                                                              
    // Example: print identifier and instance                                  
    System.out.println(entry.getKey().getValue() + " = " + entry.getValue());  
}                                                                              
// Register a callback to perform the action on future entries                 
RegistryEntryAddedCallback.event(Registry.ITEM).register((rawId, id, object) ->
{                                   …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by haykam821
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants