The OreDictionary exists primarily for inter-mod compatibility.
Items that are registered to the OreDictionary become interchangeable with other items that have the same OreDictionary name. This allows recipes to use either item to produce the same result.
Despite its name, the OreDictionary is used for much more than ores. Any item that is similar to another item (for example, dyes) can be registered to and used with the OreDictionary.
OreDictionary Name Convention
Because OreDictionary names are meant to be shared between items from different mods, they should be fairly general. Use a name that other mods are likely to use.
Forge does not require names to be in any particular format, but the following has become a popular standard for OreDictionary names:
The entire OreDictionary name typically uses camelCase (compound words that begin with a lowercase letter, where each successive word begins with a capital letter) and avoids spaces or underscores.
The first word in the OreDictionary name indicates the type of item. For unique items (such as
vine), one word is specific enough.
The last part of the name indicates the material of the item. This differentiates between
ingotGold, for example.
When two words are not specific enough, a third word can be added. For instance, granite is registered as
blockGranite while polished granite is registered as
See Common OreDictionary Names for a list of commonly used prefixes and suffixes.
This value is used to indicate that the metadata of an
ItemStack is not important. See below for an example of its use.
Using OreDictionary in Crafting Recipes
Recipes that use the OreDictionary are created and registered in much the same way as regular crafting recipes. The main difference is the use of an OreDictionary name instead of a specific
To make a recipe that can use OreDictionary entries, create a
ShapedOreRecipe instance and register it by calling
You can verify that an OreDictionary name will return a valid
ItemStack by calling
Another use of the OreDictionary in crafting is the WILDCARD_VALUE. Use by passing
OreDictionary.WILDCARD_VALUE in the constructor of an
OreDictionary.WILDCARD_VALUE should only be used for the recipe input. Using
WILDCARD_VALUE in the recipe output will only hardcode the damage of the output
Registering Items to the OreDictionary
Add entries to the OreDictionary during the
FMLPreInitializationEvent phase, after initializing the blocks and items that you will register.
OreDictionary.registerOre(ItemStack stack, String name) with an
ItemStack containing your item or block and its metadata value to register it to the OreDictionary.
You can also call one of the overloads of
OreDictionary.registerOre that take a
Item to avoid creating the
See OreDictionary Name Convention for tips on formatting the OreDictionary name of the
Common OreDictionary Names
All OreDictionary names for Minecraft items and blocks can be found in
net.minecraftforge.oredict.OreDictionary. A full list will not be included here.
Common prefixes already used in the OreDictionary include
Common prefixes for modded items include
Common suffixes in the OreDictionary include
Common suffixes for modded items include the names of metals (
Steel, etc.) and other modded materials.