tModLoader Ore Dictionary - A new tool for modders

Nobisyu_12

Terrarian
1656550437333.png

Ore Dictionary
My main base of operations is the Anarchist Mod discord server. If you need to contact me, try it through there.
Ore Dictionary is a mod that mimics Minecraft Forge's built in ore dictionary. The mod is made to add easy compatibility between mods. Any items that are registered into the Ore Dictionary will become interchangeable with items in that same group. This essentially means that recipes to use any item in the same group to craft the desired object.


As stated previously, the name comes from Minecraft Forge's built in OreDictionary. Despite this name, the mod can be used for any items, not just ores. Modders can register any item in their mod to be included in cross mod recipe groups or added to vanilla recipe groups.

As of posting this, the mod is available on tModLoader 1.4's preview branch. When the July stable is released, it should be fully functioning on that stable. I will be updating the mod as necessary based on feedback, bug reports, and of course when new preview branches release.

1656550394118.png


How to add support for your mod

The below will be a tutorial of how to add support to your mod, as I'm not going to be adding individual support for mods. That would just take too long. As of v1.0, the process is as follows:

First, add some code to your Mod class that invokes Mod.Call on the OreDictionary mod. Make sure to follow the message format perfectly. The following are the current accepted messages in Mod.Call.
Code:
"SetDictionaryKey", int itemID OR List<int> itemIDs, string dictionaryKey
"VanillaDictionaryKey", int itemID OR List<int> itemIDs, int vanillaRecipeGroupID

Code:
public override PostSetupContent()
{
    ModLoader.TryGetMod("OreDictionary", out Mod oreDictionary);
    if (oreDictionary != null && !Main.dedServ)
    {
        oreDictionary.Call("SetDictionaryKey", ModContent.ItemType<ExampleItem>(), "ExampleDictionaryKey");
     
        oreDictionary.Call("VanillaDictionaryKey", ModContent.ItemType<ExampleWoodType>(), RecipeGroupID.Wood);
    }
}

There is no strict format to follow when coming up with dictionary keys, however, generally camelCase is used. Either collaborate with other modders or use the built in option to show Ore Dictionary keys in item tooltips to add compatibility with other mods.

When adding items to dictionary keys, try to respect other mods' progression as well. So, if your Steel Bar is crafted pre-Boss, but another mod's is crafted post-Plantera, it probably wouldn't be the best thing to have those two in the same group.

As this mod is fairly new, it will take time for most mods to even discover that this exists, let alone add support. Good luck to you all.

Credit to the Trinitarian Mod for their Steel Bar sprite used in the mod icon:
 
Last edited:
Back
Top Bottom