BaseMod
BaseMod copied to clipboard
`ModHelper.isModEnabled(String mod)` doesn't work with Custom Mods added in `publishAddCustomModeMods`
@Override
public void receiveCustomModeMods(List<CustomMod> list) {
CustomMod cm = new CustomMod("MyCoolCustomModID", "p", true); // also if last param is false
list.add(cm);
}
Expected Behavior
// any patch
ModHelper.isModEnabled("MyCoolCustomModID"); // True
Actual Behavior
// any patch
ModHelper.isModEnabled("MyCoolCustomModID"); // False
Current Workaround
CardCrawlGame.trial != null && CardCrawlGame.trial.dailyModIDs().contains("MyCoolCustomModID");
The problem seems to be in getMod
which is called from setMods
.
getMod
checks a mod id against lists of mods populated in initialize
. Mods added from receiveCustomModeMods
are not added to any lists of mods in initialize
. Patching initialize
and getMod
should fix the problem.