Check Mod Loading Status in Your Code
Use the Mixin Plugin Template
The mod includes a template Mixin plugin that provides a clean way to check if a mod is loaded at runtime. This is useful for conditional code execution within your addon's logic.
Implement Runtime Checks
Inside your module or event handler, use the provided utility to query mod status:
`java
if (isModLoaded("target_mod_id")) {
// Execute code only if the mod is present
registerCrossModFeature();
}
`
Avoid Crashes
Never directly reference classes from optional mods. Always check mod presence first. If you need to use another mod's API, wrap it in a conditional check or move it to a separate module that only loads when that mod is active.
Organize by Dependency
Create separate modules for each optional mod integration. This keeps your code clean and ensures the game starts safely even if multiple mods are missing.