-
Notifications
You must be signed in to change notification settings - Fork 36
Adding Relics
Before working on relics, I would recommend making sure you understand the action queue.
If you've already read the tutorial on cards, this section will likely seem very similar.
The process of making relics has two steps.
Step 1: Make the relic.
Step 2: Register the relic.
AutoAdd is a feature of BaseMod that allows you to avoid manually registering every relic you make.
First, in your main mod file, add EditRelicsSubscriber to the subscribers at the top, and then implement the receiveEditRelics method.
public class MyMod implements
EditRelicsSubscriber, //up at the top
EditStringsSubscriber, @Override
public void receiveEditRelics() { //somewhere in the class
}AutoAdd for relics is a bit more complicated than AutoAdd for cards. All cards are normally registered with the same method, but relics are registered differently depending on their type. Specifically, character-specific relics have to be registered differently from general relics. This code utilizes information stored in the BaseRelic class to register the relic appropriately.
new AutoAdd(modID) //Loads files from this mod
.packageFilter(BaseRelic.class) //In the same package as this class
.any(BaseRelic.class, (info, relic) -> { //Run this code for any classes that extend this class
if (relic.pool != null)
BaseMod.addRelicToCustomPool(relic, relic.pool); //Register a custom character specific relic
else
BaseMod.addRelic(relic, relic.relicType); //Register a shared or base game character specific relic
if (info.seen) { //If the class is annotated with @AutoAdd.Seen, it will be marked as seen, making it visible in the relic library.
UnlockTracker.markRelicAsSeen(relic.relicId);
}
});You may need to use Alt+Enter to import some classes. Any relics you make should now be added automatically, as long as they're in the same package as BaseRelic. This includes sub-packages. If you want the details of how AutoAdd works, check the BaseMod wiki page for documentation. This code is made to work with how BasicMod is setup and will require changes if you are not using BasicMod.
If you make relics that don't extend the BaseRelic class, they will not be registered by this AutoAdd. You can register them manually with BaseMod.addRelic/addRelicToCustomPool(new YourRelic(), pool) or set up AutoAdd differently.
wip