Skip to content

Item Subtypes [1.13 and Up]

hammy3502 edited this page Apr 11, 2021 · 1 revision

The Subtype Problem

Items can have unlimited variations by using NBT or capabilities. Not all of the extra information is important for recipes, but some of it necessary to tell items apart.

Example: Your mod has a backpack that holds items, so it has a lot of NBT data. It has an upgrade recipe that only cares about the color of the backpack, but not the contents. How can JEI pay attention to the color but ignore the contents?

The Subtype Solution

The ISubtypeRegistration allows plugins to tell JEI what makes an item unique, and use that information for comparing and looking up items.

Example: Forestry bees have tons of NBT defining their genetics. The Forestry JEI plugin uses the subtype registry to tell JEI to only look at the bee's species when comparing them and when looking up recipes involving bees.

To register your item's subtypes, first create your plugin, then you are passed the ISubtypeRegistration in your plugin's registerItemSubtypes method.