Launch settings
You can use Launcher to download and launch Minecraft, and Java to download and install Java Runtime.
Tip
To easily manage Minecraft versions, mod loaders, and modpacks, it is recommended to use the url option to connect your launcher to an EML AdminTool website. This way, you can manage all your Minecraft configurations from the AdminTool dashboard without changing your launcher’s code.
Launcher
import { Launcher, CrackAuth } from 'eml-lib'
launcher()
async function launcher() {
const launcher = new Launcher({
url: 'https://at.emlproject.com',
root: 'eml',
account: new CrackAuth().auth('GoldFrite') // CrackAuth for demo purpose only
})
try {
await launcher.launch()
} catch (err) {
console.error(err)
}
} Launcher constructor
| Parameter | Type | Description | Required? |
|---|---|---|---|
config | Config (see below) | The configuration of the Launcher. | Yes |
Launcher.launch() method
Launch Minecraft.
Note
This method will patch the Log4j vulnerability.
Throws: FETCH_ERROR - If a request to get data fails. • DOWNLOAD_ERROR - If a download fails. • EXEC_ERROR - If an execution fails.
Emits: See Events below.
Config object
Tip
Check the configuration generator to easily create a valid configuration for your launcher.
| Field | Type | Description | Required? |
|---|---|---|---|
url | string | The URL of your EML AdminTool instance. Provides modpack manifest and server settings. Attention! Ignored if a Minecraft version is defined in minecraft.version or profile.minecraft.version. Defaults to latest Vanilla if no URL/version is provided. | No |
profile | IProfile | The specific profile to launch. Recommended to retrieve via Profiles.getProfiles(). Attention! In agnostic mode (no url), the profile must have a valid slug for folder naming. | No |
profile.minecraft | object | Instance-specific Minecraft configuration. Attention! Takes precedence over root minecraft config and AdminTool data. | No defaults to { version: undefined, args: [] }) |
profile.minecraft.version | string | Minecraft version (e.g., '1.20.1'). Supports 'latest_release' or 'latest_snapshot'. Attention! Setting this forces the launcher to ignore the url property. | No |
profile.minecraft.loader | object | Mod loader config for this specific profile. Ignored if profile.minecraft.version is not set. | No defaults to vanilla) |
profile.minecraft.loader.loader | 'vanilla' \| 'forge' \| 'neoforge' \| 'fabric' \| 'quilt' | The type of mod loader to utilize. | No defaults to 'vanilla') |
profile.minecraft.loader.version | string | Specific version of the loader. Required for any loader other than 'vanilla'. | No |
profile.minecraft.modpackUrl | string | Direct URL to a modpack manifest (.json). Ignored if profile.minecraft.version is not set. | No |
profile.minecraft.args | string[] | Custom Minecraft launch arguments for this profile. Use only if you know what you are doing! | No defaults to []) |
storage | 'isolated' \| 'shared' | Organization of game files: - 'isolated': Separate folder for each profile. - 'shared': Profiles share assets/libraries but separate mods, config, and saves. Attention! If 'shared', disable cleaning.enabled. | No defaults to 'isolated') |
root | string | The name of the root game directory (e.g., 'minecraft'). Automatically prefixed with a dot on Windows. | Yes |
minecraft | object | Global Minecraft configuration. Attention! Overridden if profile.minecraft is defined with a valid version. | No |
minecraft.version | string | Global Minecraft version. Supports 'latest_release'/'latest_snapshot'. Attention! Setting this forces the launcher to ignore the url property. | No |
minecraft.loader | object | Global mod loader configuration. Ignored if minecraft.version is not set. | No defaults to vanilla) |
minecraft.loader.loader | 'vanilla' \| 'forge' \| 'neoforge' \| 'fabric' \| 'quilt' | The type of mod loader to utilize globally. | No defaults to 'vanilla') |
minecraft.loader.version | string | Specific version of the loader. Required for any loader other than 'vanilla'. | No |
minecraft.modpackUrl | string | Global modpack manifest URL (.json). Ignored if minecraft.version is not set. | No |
minecraft.args | string[] | Global custom launch arguments. Use only if you know what you are doing! | No defaults to []) |
cleaning.enabled | boolean | Whether to remove unrecognized files from the instance folder. Attention! Must be false when storage is 'shared'. | No defaults to true) |
cleaning.ignored | string[] | Relative paths/files protected from cleaning (e.g., saves/, options.txt). | No defaults to standard Minecraft ignore list) |
account | Account | Authenticated player account. Use MicrosoftAuth, AzAuth, YggdrasilAuth, or CrackAuth. | Yes |
java.install | 'auto' \| 'manual' | - 'auto': Manages Java version automatically. - 'manual': Uses a pre-installed Java executable. | No defaults to 'auto') |
java.absolutePath | string | Absolute path to Java. Required if install is 'manual' and relativePath is missing. Attention! Overrides java.relativePath. | No |
java.relativePath | string | Path relative to game root or root/slug. Ignored if install is 'auto' or absolutePath is set. | No defaults to runtime/jre-X/...) |
java.args | string[] | Custom JVM arguments. Attention! Do not use for Log4j; patches are applied automatically. | No defaults to []) |
window | object | Minecraft game window configuration (width, height, fullscreen). | No defaults to 854x480) |
memory.min | number | Minimum RAM allocated to Minecraft in MB. | No defaults to 512) |
memory.max | number | Maximum RAM allocated to Minecraft in MB. | No defaults to 1023) |
Events
| Event | Description | Data |
|---|---|---|
launch_compute_download | [STEP] The launcher is computing the download size of the files to download. | - |
launch_download | [STEP] The launcher is downloading the files. | Total amount and size of the files to download. |
launch_install_loader | [STEP] The launcher is installing the loader. | The loader information. |
launch_copy_assets | [STEP] The launcher is copying the assets. | - |
launch_extract_natives | [STEP] The launcher is extracting the natives. | - |
launch_patch_loader | [STEP] The launcher is patching the loader. | - |
launch_check_java | [STEP] The launcher is checking Java. | - |
launch_clean | [STEP] The launcher is cleaning the game folder. | - |
launch_launch | [STEP] The launcher is launching Minecraft. | Minecraft information (version, loader, loader version). |
launch_data | [EVENT] Logs from Minecraft. | string |
launch_close | [EVENT] Minecraft is closed. | number (code) |
launch_debug | [EVENT] Debug logs from the launcher. | string |
download_progress | [EVENT] The launcher is downloading a file. | The type of file being downloaded, the total amount and size of the files to download, the total amount and size of the downloaded files, the download speed. |
download_error | [EVENT] An error occurred while downloading a file. | The filename and the type of file, and the error message. |
download_end | [EVENT] The launcher has finished downloading a type of files. | The amount and size of the downladed files. |
extract_progress | [EVENT] The launcher is extracting a file. | The filename. |
extract_end | [EVENT] The launcher has finished extracting a type of files. | The amount of files extracted. |
copy_progress | [EVENT] The launcher is copying a file. | The filename and its destination. |
copy_end | [EVENT] The launcher has finished copying a type of files. | The amount of files copied. |
copy_debug | [EVENT] Debug logs from the copying process. | string |
java_info | [EVENT] Java information. | The Java version and architecture. |
patch_progress | [EVENT] The launcher is patching a file. | The filename. |
patch_end | [EVENT] The launcher has finished patching a type of files. | The amount of files patched. |
patch_error | [EVENT] An error occurred while patching a file. | The filename and the error message. |
patch_debug | [EVENT] Debug logs from the patching process. | string |
clean_progress | [EVENT] The launcher is cleaning a file. | The filename. |
clean_end | [EVENT] The launcher has finished cleaning a type of files. | The amount of files cleaned. |
[STEP] - The event is a main step of the launch process.
[EVENT] - The event is an event of the step during the launch process.
Java
import { Java } from 'eml-lib'
async function java() {
const java = new Java({
url: 'https://at.emlproject.com',
root: 'eml',
minecraft: {
version: '1.20.1'
}
})
try {
await java.download()
} catch (err) {
console.error(err)
}
} Java constructor
| Field | Type | Description | Required? |
|---|---|---|---|
config.url | string | The URL of your EML AdminTool website, where is stored your modpack and loader info. | No but strongly recommended |
config.root | string | The name of the game folder, without the dot (e.g. 'minecraft'). This will be used to create the server folder (e.g. .minecraft). | Yes |
config.minecraft.version | string | The version of Minecraft you want to install Java for. Set to 'latest_release' to install Java for the latest release version of Minecraft, or 'latest_snapshot' to install Java for the latest snapshot. Set to undefined to get the version from the EML AdminTool. | No (defaults to undefined) |
Java.getFiles() method
Get the files of the Java version to download.
| Parameter | Type | Description | Required? |
|---|---|---|---|
manifest | MinecraftManifest | The manifest of the Minecraft version. If not provided, the manifest will be fetched. | No |
Returns: Promise<File[]> - The files of the Java version.
Throws: FETCH_ERROR - If a request to get data fails.
Java.download() method
Download Java for the Minecraft version.
Returns: Promise<void>
Throws: DOWNLOAD_ERROR - If an error occurs while downloading Java.
Emits: download_progress - The files are downloading. • download_error - Error while downloading the files. • download_end - The files are downloaded.
Java.check() method
Check if Java is correctly installed.
| Parameter | Type | Description | Required? |
|---|---|---|---|
absolutePath | string | Absolute path to the Java executable. You can use ${X} to replace it with the major version of Java. | No (defaults to the installed Java path) |
majorVersion | number | Major version of Java to check. | No (defaults to 8) |
Returns: Promise<{ version: string; arch: '64-bit' | '32-bit' }> - The version and architecture of Java.
Throws: JAVA_ERROR - If Java is not correctly installed or does not match the required major version.