Mods Resource Packs Data Packs Plugins Shaders Modpacks
Get Modrinth App
Upgrade to Modrinth+
Sign in
ModsPluginsData PacksShadersResource PacksModpacks
Sign in
Settings

Preloading Tricks

Add hook before setup mod for Quilt, Forge, Fabric

1,909
7
Library
AboutChangelogVersions

Preloading Tricks

A mod that adds a hook before setting up the main mod. Mainly used for ModSets and AutoModpack.
It only depends on the loader version. It may work on lower versions than these, but that needs testing and feedback.

  • Fabric 0.14
  • Quilt 0.20
  • Forge 40

Callbacks

Setup Mod

The callback is using Java's ServiceLoader feature.
It will be invoked just before setting up the mods.

Using SetupModService implementations for platforms to control the mod loading.

  • Forge: https://github.com/SettingDust/preloading-tricks/blob/main/fml-45/src/main/java/settingdust/preloadingtricks/forge/ForgeLanguageProviderCallback.java#L98
  • Fabric: https://github.com/SettingDust/preloading-tricks/blob/main/fabric-loader-0.14/src/main/java/settingdust/preloadingtricks/fabric/FabricLanguageProviderCallback.java#L64
  • Quilt: https://github.com/SettingDust/preloading-tricks/blob/main/quilt-loader-0.20/src/main/java/settingdust/preloadingtricks/quilt/QuiltLanguageProviderCallback.java#L62

With the callback, you can control the mod loading.
Notice: It's not recommended to add mods since it can't load mods from a file or classpath. Using IModLocator is officially supported by Forge.

Language Provider

The callback is using Java's ServiceLoader.
It's invoked much earlier than setting up the main mod.

90% of ad revenue goes to creators

Support creators and Modrinth ad-free with Modrinth+

Compatibility

Minecraft: Java Edition

1.21
1.20.x
1.19.x
1.18.x
1.16.5

Platforms

Fabric
Forge
NeoForge
Quilt

Supported environments

Client only
Server only
Singleplayer
Client and server (optional)

Links

Report issues View source Join Discord server
Donate on Ko-fi

Creators

settingdust
settingdust Owner

Details

Licensed MIT
Published last year
Updated 8 months ago

Modrinth is open source.

new-project-page@ac78952

© Rinth, Inc.

Company

TermsPrivacyRulesCareers

Resources

SupportBlogDocsStatus

Interact

Discord X (Twitter) Mastodon Crowdin
Get Modrinth App Settings
NOT AN OFFICIAL MINECRAFT SERVICE. NOT APPROVED BY OR ASSOCIATED WITH MOJANG OR MICROSOFT.