Creating the Entrypoint
To integrate with Packed Packs, you must implement the PackedPacksInitializer interface.
This serves as the single entry point for your mod to interact with the API.
Implementing the Initializer
The onInitialize method provides you with the PackedPacksApi instance.
IMPORTANT
The onInitialize method may be called off the main thread. Ensure your registration logic is thread-safe.
java
public class MyPackedPacksIntegration implements PackedPacksInitializer {
@Override
public void onInitialize(PackedPacksApi api) {
// Access core services
PreferenceRegistry preferences = api.preferences();
EventBus eventBus = api.eventBus();
}
}Registering the Initializer
Fabric
Register your implementation in fabric.mod.json under the packed_packs entrypoint key:
json
"entrypoints": {
"packed_packs": ["com.example.modid.MyPackedPacksIntegration"]
}NeoForge
Use the standard Java ServiceLoader SPI. Create a provider configuration file:
- META-INF
- services
- io.github.fishstiz.packed_packs.api.PackedPacksInitializer
- services
com.example.mod.MyMyPackedPacksIntegration