Overview
Stage 0 provides the initial entrypoint for Essential Loader on each mod loading platform. It discovers, extracts, and loads Stage 1 from embedded JAR resources. Stage 0 must be loaded by the platform’s native class loader to ensure proper isolation and relocation.Core Components
EssentialLoader (Common)
The shared implementation for discovering and loading Stage 1 across all platforms. Package:gg.essential.loader.stage0
Platform variant identifier (e.g., “launchwrapper”, “fabric”, “modlauncher8”)
loadStage1File()
Discovers and extracts the most recent Stage 1 JAR file.Game directory for extracting Stage 1 files
Path to the extracted Stage 1 JAR file ready for class loading
- Checks for
stage1.update.jarand applies updates if present - Scans classpath for all
gg/essential/loader/stage0/stage1.jarresources - Compares versions using manifest
Implementation-Versionattribute - Extracts the latest version to
essential/loader/stage0/{variant}/stage1.jar - Returns the extracted file path
Platform Implementations
LaunchWrapper Platform
EssentialSetupTweaker
Entrypoint tweaker for Minecraft Forge’s LaunchWrapper system. Package:gg.essential.loader.stage0
Implements: net.minecraft.launchwrapper.ITweaker
- Extract Stage 1: Calls
loadStage1File()usingLaunch.minecraftHome - Add to ClassLoader: Adds Stage 1 JAR to
LaunchClassLoaderand its parent - Exclusion: Registers
gg.essential.loader.stage1.package exclusion - Instantiate: Loads Stage 1’s
EssentialSetupTweakervia reflection - Delegate: Forwards all
ITweakercalls to Stage 1 instance
Fabric Platform
EssentialSetupPreLaunch
Fabric preLaunch entrypoint for loading Stage 1. Package:gg.essential.loader.stage0
Implements: net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint
- Extract Stage 1: Calls
loadStage1File()using Fabric’s game directory - Create ClassLoader: Creates isolated
URLClassLoaderwith Stage 1 JAR - Instantiate: Loads Stage 1’s
EssentialSetupPreLaunchclass - Delegate: Forwards
onPreLaunch()call to Stage 1 instance
ModLauncher Platform
EssentialTransformationService
Transformation service for Minecraft Forge’s ModLauncher system (1.13+). Package:gg.essential.loader.stage0
Implements: cpw.mods.modlauncher.api.ITransformationService (via delegation)
Separate implementations exist for ModLauncher 8, 9, 10, and 11 to handle API differences.
- Get Game Directory: Queries ModLauncher environment for
GAMEDIR - Extract Stage 1: Calls
loadStage1File()with discovered game directory - Create ClassLoader: Creates isolated
URLClassLoaderwith Stage 1 JAR - Instantiate: Loads Stage 1’s
EssentialTransformationServiceclass - Delegate: Forwards all
ITransformationServicecalls to Stage 1 instance
modlauncher8: Forge 1.15-1.16 (ModLauncher 8.x)modlauncher9: Forge 1.17-1.20.1 (ModLauncher 9.x/10.x)modlauncher11: NeoForge 1.20.2+ (ModLauncher 11.x)
Relocation Requirements
Required Relocations
- Class Uniqueness: Each mod needs its own Stage 0 instance in the platform class loader
- Conflict Avoidance: Multiple mods may bundle different Stage 0 versions
- Isolation: Stage 0 must bootstrap independently per mod
- Version Management: Each mod controls its own Stage 1 discovery
Relocation Verification
Stage 1 Discovery Algorithm
Version Comparison
Discovery Order
- Check for existing
stage1.jarin data directory - Check for pending
stage1.update.jar - Scan classpath for embedded
gg/essential/loader/stage0/stage1.jarresources - Compare all versions and select highest
- Extract selected version if newer than current
Error Handling
Common Errors
Failed to read version from stage1.jar
Failed to read version from stage1.jar
Cause: Corrupted JAR file or missing manifestResolution: Stage 0 will skip the corrupted file and try next available version
No embedded stage1 jar files found
No embedded stage1 jar files found
Cause: Stage 1 JAR not properly bundled in container JARResolution: Ensure
stage1.jar is included at gg/essential/loader/stage0/stage1.jarLaunch.minecraftHome is null
Launch.minecraftHome is null
Cause: ForgeGradle development environment missing game directory argumentResolution: Stage 0 defaults to current directory (
.) for developmentDevelopment & Testing
Embedding Stage 1
Local Testing
See Also
- Stage 1 API - Configuration and update management
- Stage 2 API - Chain-loading and mod installation
- Integration Guides - Platform-specific setup