-1

So, in Forge 1.6 and previous, if you wanted to get a list of all items available in the game, you could just do

Items.itemList

This would return an Item[], containing all the vanilla items and all the items added by other mods. The problem is, in 1.7, as part of the new changes to the block/item system, they got rid of this field, in preference for the itemRegistry. My question is, has anyone yet figured out how to do the same thing in 1.7, i.e. retrieve a list of items for use? I'd imagine there has to be some way to do this, because mods like TMI have updated for 1.7. Only issue is they're closed-source.

If no one knows, then I suppose I'll just have to wait for NEI to be updated and look at his code.

3
  • Have you checked the API? I looked over it a couple times and saw nothing but it is a good place to start. Its available under the 'javadoc' link on this page.
    – willl459
    Commented Feb 10, 2014 at 5:23
  • I'll admit, I haven't looked at it as heavily as perhaps I might have, but I have gone through a few searches and found nothing.
    – user68931
    Commented Feb 10, 2014 at 5:30
  • I've tried looking through the javadocs, but have still been unable to find anything which can do this. If I use reflection on net.minecraft.init.Items, I can get a list of Fields which allow me to get all of the vanilla items, but I was hoping to get it for all of the mods.
    – user68931
    Commented Feb 10, 2014 at 22:44

1 Answer 1

0
Set example = GameData.itemRegistry.getKeys();

Returns a Set with the registered items. You can also get the block version by substituting item for block. I haven't tested to see what you can actually do with this but at the very least you should be able to get the unlocalized name of registered items out of this Set.

2
  • This seems a little unclear. Is it a Set of Items, or a Set of Strings of the ids (i.e. unlocalized names)?
    – user68931
    Commented Mar 17, 2014 at 4:23
  • itemRegistry is deprecated. Any alternatives?
    – ndm13
    Commented Aug 25, 2015 at 16:48

You must log in to answer this question.