Prerequisites
- A Minecraft mod project using Gradle
- Basic knowledge of Kotlin or Java
- Minecraft Forge or Fabric mod loader
Add the Dependency
Gradle Configuration
Add the Essential repository and API dependency to yourbuild.gradle or build.gradle.kts file.
The
+ version selector will always use the latest version. For production, pin to a specific version like 1.3.2 to ensure stability.Version Compatibility
Essential API is available for multiple Minecraft versions and mod loaders:- Forge:
1.8.9-forge,1.12.2-forge,1.16.5-forge,1.18.2-forge,1.19.4-forge,1.20.1-forge - Fabric:
1.16.5-fabric,1.18.2-fabric,1.19.4-fabric,1.20.1-fabric,1.21-fabric
Dependencies Included
When you add Essential API, you get access to these libraries:Kotlin Standard Library
Kotlin Standard Library
kotlin-stdlib-jdk8kotlin-reflectkotlinx-coroutines-coreandkotlinx-coroutines-jdk8kotlinx-serialization-coreandkotlinx-serialization-json
Kodein DI
Kodein DI
Dependency injection framework (version 7.6.0) for managing instances
Elementa
Elementa
Modern GUI framework for Minecraft - create beautiful, reactive UIs
Vigilance
Vigilance
Configuration GUI framework for mod settings
UniversalCraft
UniversalCraft
Cross-version Minecraft abstraction layer
Access the API
Once the dependency is added, you can access the API in your code.Method 1: Static Instance (Recommended for Java)
Get the API instance using the staticgetInstance() method:
Method 2: Static Helper Methods
Use the static helper methods for quick access:Method 3: Dependency Injection (Kotlin Only)
Use Kodein DI for cleaner dependency management:Adding Your Own Types to DI
You can extend Essential’s DI system with your own modules:Your First API Call
Let’s create a simple example that sends a notification when your mod loads:Verify Installation
To verify that Essential API is properly set up:- Build your mod with
./gradlew build - Run your mod in the development environment
- Check that:
- No compilation errors related to Essential classes
- Essential is loaded in the mods list
- Your API calls execute without exceptions
If you see a notification from your mod, congratulations! You’ve successfully integrated the Essential API.
Common Issues
Class not found errors
Class not found errors
Make sure you’ve added the Essential repository to your
repositories block and that the version string matches your Minecraft version and mod loader.DI not initialized error
DI not initialized error
The DI system is initialized when Essential loads. Make sure Essential is installed and that you’re not trying to access the API too early in the mod loading lifecycle. Use
FMLPostInitializationEvent or later.Version conflicts
Version conflicts
If you have version conflicts with Kotlin or other libraries, you can exclude them:
Next Steps
Now that you have Essential API set up, explore what you can build:Register Commands
Create custom commands with powerful argument parsing
Send Notifications
Display beautiful notifications to users
Build GUIs
Create modern user interfaces with Elementa
Use Utilities
Access Minecraft helpers and Mojang API integration