quilt-loader icon indicating copy to clipboard operation
quilt-loader copied to clipboard

Expose loader's error gui system for mods to show errors.

Open AlexIIL opened this issue 1 year ago • 0 comments

This means:

  • Moving org.quiltmc.loader.api.plugin.gui to org.quiltmd.loader.api.gui, and changing their "Internal Hidden" status from PLUGIN_API to not be annotated at all (since it's in the API it's not restricted).
  • Moving QuiltPluginError to that package too.
  • Adding functionality for mods to provide translations for QuiltLoaderText - possibly by adding a new functional-interface entrypoint interface QuiltLoaderTranslator { @Nullable String translate(String key); }, and PR'ing an implementation to QSL that uses minecraft's translation system.
  • Adding functionality to let mods run code when a button is pressed, and allow mods to later mark an error as "fixed".
  • Adding functionality to allow mods to display separate (simple) dialogs whenever they want to. Full support for opening custom swing windows is planned, but not in this issue - as we need to send mod code over to the gui process to actually build the window.
  • Add a way to buffer multiple errors at once - for example this would allow all entrypoints from mods to be called, and 1 error shown from each one that failed. (This likely means re-entrant entrypoint invocation by the code that reads the error).

For example this could be used as a fix for #244, by showing an error message with the following:

<mod> Failed to read config file <file>

[ Edit File ]  [ Retry ]  [ Delete File ]

Where the edit file button opens the file in a text editor (like how the [ View Crash Report ] button works at the moment). The [ Retry ] button would retry loading, and display a warning message if the file still can't be read. The [ Delete File ] button would delete the file so the config can be reset back to default. (Maybe it should say something else - like Reset File?)

The main error window would need to get buttons to [ Exit ] and [ Continue ], although the continue button would only display a warning message if some of the errors haven't been fixed.

Ideally we'd also test a [ Restart ] button, but that's not strictly necessary yet.

AlexIIL avatar Feb 23 '23 19:02 AlexIIL