Wiki 9Minecraft Wiki 9Minecraft
Distant Horizons Api Wiki › Guides › How to Keep Your Mod Compatible Across Loaders With the Distant Horizons API

How to Keep Your Mod Compatible Across Loaders With the Distant Horizons API

The Compatibility Goal

The Distant Horizons API Mod is designed to be mod-loader independent. That means a single integration should work whether the player runs Distant Horizons through one loader or another. Your job is to avoid reintroducing loader-specific code into that path.

Practical Rules

1. Never import Distant Horizons' own classes in your integration code. Route everything through the API mod's exposed interface.

2. Keep loader-specific code (event registration, config systems, entry points) in separate, thin layers, and have those layers call into one shared API-based core.

3. Declare the API mod as a dependency in each loader's metadata so it is present regardless of which loader the player uses.

4. Guard every API call with an availability check, and degrade gracefully if Distant Horizons or the API is missing.

Verifying Cross-Loader Behavior

Test your mod on each loader you support with Distant Horizons installed, and again without it. The behavior with Distant Horizons should be identical across loaders; the behavior without it should be a clean no-op rather than a crash. If you find yourself writing loader-specific branches inside your Distant Horizons integration, stop and move that logic back behind the API — that is exactly the situation the API was created to prevent.