Skip to content

Mod Loading Process

Trin Wasinger edited this page Oct 21, 2026 · 6 revisions

Warning

While functional, the specifics of this feature are still being finalized and may change some.

Overview

Specter recursively searches the <mods> folder to discover files (depth-first, lexicographically).

  • Folders and files starting with a . or ending with *.disabled are skipped.
  • *.zip files directly in <mods> (but not subdirectories) are searched as if they were folders.
  • *.jar files are added to the classpath.
    • Specter's currently running jar is skipped if present.
    • Class Transformers listed in the Transformer-Classes attribute of the jar's manifest are loaded (space and/or comma separated).
    • The static method run() is called on classes listed in the Script-Classes attribute of the jar's manifest (space and/or comma separated).
  • *.groovy, *.gvy, *.gy, and *.gsh files are compiled as Groovy.
    • All annotated Class Transformers are loaded.
    • If the top level class is a groovy.lang.Script (either explicitly or by having top level statements), it is executed (initialize mods, access tweakers, and event listeners here).
  • All other files (e.g., READMEs, LICENSEs, and assets) are ignored.

Caching

To improve subsequent start-up times, Specter caches compiled classes in <mods>/.cache. Cached files are automatically invalidated if the original file changes. Classes loaded from the cache appear as if they were still loaded from their original location (e.g., for CodeSource#location and Groovy's SourceURI).

Notes

  • All *.jar files are loaded in a first pass before any Groovy files so that scripts can use them.
  • As an alternative to including *.jar dependencies directly, Groovy's Grab annotation can be used to load from maven repositories.
  • To force a specific load order, prepend 00_, 01_, 02_, etc... to entries.

Clone this wiki locally