Add mechanism for mods to abort loading
Sometimes, a mod needs to abort the loading process and have the user close or restart the game.
The best way to do so seems to be via ModLoader.addLoadingIssue() and passing an issue with severity ERROR;
however, this method is marked as @ApiStatus.Internal, so mods probably should not be using it.
Either unmark it as internal, or add a proper way for mods to abort the loading process.
Have you tried throwing a ModLoadingException? :-P
Have you tried throwing a ModLoadingException? :-P
That does not quite work because it gets double-wrapped (there's a catch for Throwable which then gets wrapped in a ModLoadingException without care for whether it already is one)
throwing ModLoadingException:
adding to the list manually via ModLoader.addLoadingIssue():
Don't use addLoadingIssue, you can't guarantee that the loader will ever check that again depending on where you do it.
If your plan is to actually ask the user to restart the game, I actually wanted to add a specific mechanism for requesting that for other reasons.
However: We'd need to check the double wrap, really. Usually we do check for ModLoadingExceptions.
Don't use addLoadingIssue, you can't guarantee that the loader will ever check that again depending on where you do it.
Fair enough
If your plan is to actually ask the user to restart the game, I actually wanted to add a specific mechanism for requesting that for other reasons.
My plan is to use a GraphicsBootstrapper in some specific circumstances; I dont want to ship the main mod as jar-in-jar file, so I opted to ship a separate jar for the bootstrap service and extract it only when necessary, then ask the user to restart the game to get it loaded (currently by means of throwing a ModLoadingException).
However: We'd need to check the double wrap, really. Usually we do check for ModLoadingExceptions.
That would be great, yes
My plan is to use a
GraphicsBootstrapperin some specific circumstances; I dont want to ship the main mod as jar-in-jar file, so I opted to ship a separate jar for the bootstrap service and extract it only when necessary, then ask the user to restart the game to get it loaded (currently by means of throwing aModLoadingException).
You do realize your mod will likely be excluded from ATM for that, yes?