Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/lDEVinux/eaglercraft/llms.txt

Use this file to discover all available pages before exploring further.

Eaglercraft compiles the Minecraft 1.5.2 Java codebase to JavaScript using TeaVM via a Gradle build. The primary output is classes.js (the browser client) and classes_server.js (the integrated singleplayer server worker). Custom resource packs are compiled separately as EPK files.

How the Build Works

The build.gradle file applies the io.github.zebalu.teavm-gradle-plugin (version 1.0.0) to transpile Java source into optimized JavaScript. Key details of the build configuration:
  • Java compatibility: Source and target are both set to Java 8
  • Source sets: Three directories are combined into a single main source set:
    • src/main/java — shared Minecraft client classes
    • src/teavm/java — TeaVM-specific adapter and entry point
    • sp-server/src/ipc/java — singleplayer server IPC bridge
  • Main class: net.lax1dude.eaglercraft.Client (defined in src/teavm/java)
  • Entry point name: main
  • Output file: javascript/classes.js
  • Optimization level: ADVANCED — produces highly compact, aggressively inlined output
  • Heap size: 4 MB minimum / 128 MB maximum for the TeaVM virtual machine

Prerequisites

Before building, ensure the following are installed:
  • Java JDK 8 — a full JDK is required (not just a JRE); TeaVM performs bytecode analysis at compile time
  • Gradle — you can use the included gradlew / gradlew.bat wrapper and do not need a separate Gradle installation

Compiling the JavaScript Client

1

Clone the repository

git clone https://github.com/lDEVinux/eaglercraft.git
cd eaglercraft
2

Run the TeaVM compile target

On Linux or macOS:
./gradlew teavm
On Windows:
gradlew.bat teavm
3

Wait for compilation to finish

The ADVANCED optimization level performs thorough whole-program analysis and inlining. Expect the build to take several minutes depending on your hardware.
4

Locate the compiled output

Once the build completes successfully, the output files appear at:
  • javascript/classes.js — the compiled browser client
  • javascript/classes.js.map — the source map for debugging
The LWJGL desktop runtime (src/lwjgl/) is no longer supported and is included in the repository for historical reference only. Only the TeaVM (web) compilation target should be used.

Compile Configuration

The following block shows the key TeaVM settings from build.gradle:
build.gradle
teavm {
   minifying = true
   maxTopLevelNames = 10000
   debugInformationGenerated = false
   sourceMapsGenerated = true
   targetDirectory = file("javascript")
   targetFileName = "classes.js"
   mainClass = 'net.lax1dude.eaglercraft.Client'
   entryPointName = 'main'
   optimizationLevel = "ADVANCED"
   minHeapSize = 4
   maxHeapSize = 128
}

Compiling Resource Packs (EPK)

Game assets (textures, sounds, and other resources) are stored in lwjgl-rundir/resources/ and must be compiled into a single assets.epk archive that the browser client loads at runtime. The epkcompiler/run.bat script calls:
java -jar epkcompiler/CompilePackage.jar "lwjgl-rundir/resources" "javascript/assets.epk"
Run the appropriate script for your platform from the repository root:
CompileEPK.bat
The compiled asset pack is written to javascript/assets.epk.

Deploying Compiled Output

After a successful build, copy the following files to your web server to replace the pre-built stable-download versions:
  • javascript/classes.js
  • javascript/assets.epk
Do NOT commit javascript/classes.js, javascript/classes_server.js, javascript/assets.epk, or any files in stable-download/ to pull requests. The project maintainer recompiles all generated artifacts after merging source changes.

Build docs developers (and LLMs) love