-
Notifications
You must be signed in to change notification settings - Fork 24
IMC documentation (for modders)
Instead of having to stick a bunch of APIs in your mod for Reliquary support, Reliquary leverages FMLInterModComms to easily allow you access to our APIs. IMC can be used to send 'messages' between mods, commonly a String or NBTTagCompound.
Just getting started with IMC? Read under Destruction Catalyst, as it describes the process of how to implement IMC functionality with Reliquary.
Made a new fancy terrain block, but can't use it with the Destruction Catalyst? Easy.
FMLInterModComms.sendMessage("xreliquary", "DestructionCatalyst",
String.valueOf(Block.obsidian.blockID));
In the following example, we are adding a message to FMLInterModComms's queue, so Reliquary can receive these messages in between the Init and PostInit phases (so you need to call this before the end of the Init phase). We send to the mod ID "xreliquary", with the key "DestructionCatalyst". Keys are used by mods receiving IMCs determine how the value (3rd parameter) should be handled.
This example will be sent to Reliquary as previously stated. From there on, Obsidian will be destroyable via the Destruction Catalyst!
Thanks to IMC, you can add your own recipes to the Tomb of Alkahest, with all the advantages of the API solution. To register a recipe with Reliquary, use something like this example...
NBTTagCompound send = new NBTTagCompound();
send.setInteger("cost", 32);
send.setInteger("yield", 1);
send.setCompoundTag("item", new NBTTagCompound());
stack.writeToNBT(send.getCompoundTag("item"));
FMLInterModComms.sendMessage("xreliquary", "Alkahest", send);
In this example, we start by making a NBTTagCompound. This compound, "send", is what we will be sending to Reliquary. We set the cost to 32, making this recipe use 32 Redstone from the Tomb when it is used. We set the yield to 1, so the recipe will always return one more of the item (1 + the current item). Then we set our item as "item", so Reliquary can register it.
Finally, we use the "Alkahest" key to tell Reliquary that we are adding a recipe.
Got an ore you want to add, have it registered with the OreDictionary? Great, Reliquary supports that too! It's exactly the same as registering a normal recipe, with just two small changes. Let's look at the following example.
NBTTagCompound send = new NBTTagCompound();
send.setString("dictionaryName", "ingotCopper");
send.setInteger("cost", 32);
send.setInteger("yield", 1);
stack.writeToNBT(send.getCompoundTag("item"));
FMLInterModComms.sendMessage("xreliquary", "AlkahestDictionary", send);
Instead of registering our item, we just tell Reliquary the OreDictionary name it is under. Also, notice we are using the key "AlkahestDictionary", telling Reliquary that we want this to be handled as an Ore Dictionary recipe.