Full Example of how to modify the starting relics for the Ironclad such that he starts with Black Blood instead of Burning Blood
importjava.util.ArrayList;
importbasemod.ModLabel;
importcom.megacrit.cardcrawl.characters.AbstractPlayer;
importcom.megacrit.cardcrawl.characters.Ironclad;
importorg.apache.logging.log4j.LogManager;
importorg.apache.logging.log4j.Logger;
importcom.badlogic.gdx.graphics.Texture;
importcom.evacipated.cardcrawl.modthespire.lib.SpireInitializer;
importcom.megacrit.cardcrawl.core.Settings;
importcom.megacrit.cardcrawl.unlock.UnlockTracker;
importcom.megacrit.cardcrawl.characters.AbstractPlayer.PlayerClass;
importbasemod.BaseMod;
importbasemod.ModPanel;
importbasemod.interfaces.PostCreateStartingRelicsSubscriber;
importbasemod.interfaces.PostInitializeSubscriber;
@SpireInitializer// this annotation tells ModTheSpire to look at this class to initialize our modpublicclassSampleModimplementsPostCreateStartingRelicsSubscriber, PostInitializeSubscriber {
publicstaticfinalLoggerlogger = LogManager.getLogger(SampleMod.class.getName()); // lets us log outputpublicstaticfinalStringMODNAME = "Sample Mod"; // mod namepublicstaticfinalStringAUTHOR = "You"; // your namepublicstaticfinalStringDESCRIPTION = "v1.0.0 - makes the Ironclad OP"; // description (w/ version # if you want)publicSampleMod() {
logger.info("subscribing to PostCreateStartingRelics and postInitialize events");
// when our mod is loaded we tell BaseMod that we want to do something when the starting relics are created for the character when they start a run// as well as when the game as finished initializing itself. these are defined earlier (in implements)BaseMod.subscribe(this);
}
publicstaticvoidinitialize() { // ModTheSpire will call this method to initialize because of the annotation we put at the top of the class definition@SuppressWarnings("unused")
SampleModmod = newSampleMod();
}
@OverridepublicvoidreceivePostInitialize() {
// Mod badgeTexturebadgeTexture = newTexture("badge_img.png");
ModPanelsettingsPanel = newModPanel();
ModLabellabel = newModLabel("My mod does not have any settings (yet)!", 400.0f, 700.0f, settingsPanel, (me) -> {});
settingsPanel.addUIElement(label);
BaseMod.registerModBadge(badgeTexture, MODNAME, AUTHOR, DESCRIPTION, settingsPanel); // once the game has initialized we want to set up a **mod badge** which is a little icon on the main menu screen that tells users that our mod has been loaded
}
@OverridepublicvoidreceivePostCreateStartingRelics(PlayerClassplayerClass, ArrayList<String> relicsToAdd) {
if (playerClass == PlayerClass.IRONCLAD) { // only give the relic if the class is ironcladrelicsToAdd.add("Black Blood"); // here we simply give the player black blood in addition to their other starting relicsUnlockTracker.markRelicAsSeen("Black Blood");
}
}
}
Some mods using BaseMod
(https://github.com/Gremious/StS-DefaultModBase) - This Mod is highly recommended. Please use this as an excellent jumping off point with examples and good practices! Some of the others below are outdated.