Skip to content

Implement reload manager API and add Fabric/NeoForge hooks#11

Merged
Adammatthiesen merged 2 commits into
mainfrom
reload-manager
May 31, 2026
Merged

Implement reload manager API and add Fabric/NeoForge hooks#11
Adammatthiesen merged 2 commits into
mainfrom
reload-manager

Conversation

@Adammatthiesen
Copy link
Copy Markdown
Member

This pull request introduces a cross-platform "reload runnable" API to MatthiesenLib, allowing mods to register callbacks that will be executed when a server reload occurs (e.g., data pack reload). The implementation covers both Fabric and NeoForge, ensuring that registered reload actions are executed with logging and error handling. The API exposes new methods for registering and retrieving reload callbacks, and the library's main facade forwards these for convenience.

New Reload Runnable API:

  • Added MatthiesenLibReloadManager to manage per-mod reload callbacks, including methods to register and retrieve runnables, with duplicate registration checks and logging ([api/common/src/main/java/dev/matthiesen/common/matthiesen_lib_api/core/MatthiesenLibReloadManager.javaR1-R56](https://github.com/Matthiesen-dev/matthiesen-lib/pull/11/files#diff-f39cbb951f4a0d486353f7530d5ab6fe9f4d824833569cba3cf92e60bb790b78R1-R56)).
  • Exposed registerReloadRunnable and getReloadRunnables methods on both MatthiesenLibApi and the main facade MatthiesenLib for mod developer use ([[1]](https://github.com/Matthiesen-dev/matthiesen-lib/pull/11/files#diff-5f4886732ac5f6667652572a901adf1f3b79d41a243d3df8531f0cb3d6548520R186-R204), [[2]](https://github.com/Matthiesen-dev/matthiesen-lib/pull/11/files#diff-0220b44d25d092beeb57278778807d974425641a5b1f1373e119ccfa830b2eddR224-R242)).

Platform Integration for Reload Events:

  • Fabric: Hooks into ServerLifecycleEvents.END_DATA_PACK_RELOAD to execute all registered reload runnables on successful reload, with per-mod logging and error handling ([api/fabric/src/main/java/dev/matthiesen/fabric/matthiesen_lib_api/MatthiesenLibApiFabric.javaR32-R46](https://github.com/Matthiesen-dev/matthiesen-lib/pull/11/files#diff-fe97a1bcca8f2fc461a4d2ae2edf4c9578bc81acbd5da06737735003b1a25d41R32-R46)).
  • NeoForge: Subscribes to AddReloadListenerEvent and adds a helper MatthiesenLibReloadListener that runs all registered reload callbacks with logging and error handling during the reload phase ([[1]](https://github.com/Matthiesen-dev/matthiesen-lib/pull/11/files#diff-32fcbe55464e3aa03de84f2a1ff09e6ff515a42817d6679653b0cabb9169dd36R46-R54), [[2]](https://github.com/Matthiesen-dev/matthiesen-lib/pull/11/files#diff-359a3cd498773127ea682a540c18adf6ab3cd47261e192342c7dee227dad851bR1-R37)).

Documentation:

  • Updated DEV-DOCS.md with migration notes, usage instructions, and behavioral details for the new reload API, including platform-specific integration notes ([DEV-DOCS.mdR5-R32](https://github.com/Matthiesen-dev/matthiesen-lib/pull/11/files#diff-a99cd6dc6474e1605545d40164dac228efd82dc274af2f9b593922135bda1651R5-R32)).

@Adammatthiesen Adammatthiesen marked this pull request as ready for review May 31, 2026 02:09
@Adammatthiesen Adammatthiesen merged commit b2167da into main May 31, 2026
2 checks passed
@Adammatthiesen Adammatthiesen deleted the reload-manager branch May 31, 2026 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant