Launch settings
You can use Launcher to download and launch Minecraft.
Warning
It is highly recommended to use Launcher with the EML AdminTool website. Without it, you will not be able to download mods (including loaders such as Forge or Fabric), resource packs, and more.
import { Launcher, CrackAuth } from 'eml-lib'
launcher()
async function launcher() {
const launcher = new Launcher({
url: 'https://at.emlproject.pages.dev',
serverId: 'eml',
account: new CrackAuth().auth('GoldFrite')
})
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
| Field | Type | Description | Required? |
|---|---|---|---|
url | string | The URL of your EML AdminTool website, where is stored your modpack and loader info. If you don’t set this value, the launcher will use the vanilla version of Minecraft (loaders such as Forge and Fabric are only available through the EML AdminTool). | No but strongly recommended |
serverId | string | Your Minecraft server ID (eg. 'minecraft'). This will be used to create the server folder (eg. .minecraft). | Yes |
cleaning.clean | boolean | Should the launcher clean the game folder before launching the Minecraft game? In most cases, you should set this value to true. Set this value to false if you want to keep allow the players to keep their mods, resource packs, etc., or if you want to install multiple instances of Minecraft on the same game folder. | No (default is true) |
cleaning.ignored | string[] | The list of paths/files to ignore when checking and cleaning the game folder, before launching the Minecraft game. Attention! If you don’t include 'runtime/' in this list, the launcher will delete the Java installation folder when cleaning the game folder. | No (default is ['runtime/', 'crash-reports/', 'logs/', 'resourcepacks/', 'resources/', 'saves/', 'shaderpacks/', 'options.txt', 'optionsof.txt']) |
account | Account | The player account (use MicrosoftAuth, AzAuth or CrackAuth to get the account, but you should not authenticate the user directly in the config, to be able to handle authentication). | Yes |
minecraft.version | string | The version of Minecraft you want to install. Set to 'latest_release' to install the latest release version of Minecraft, or 'latest_snapshot' to install the latest snapshot. Set to null or undefined to get the version from the EML AdminTool. | No (default is null) |
minecraft.args | string[] | Use this option only if you know what you are doing! Add custom arguments to launch Minecraft. | No |
java.install | 'auto' or 'manual' | Should the launcher install Java automatically? 'auto' automatically installs Java when calling Launcher.launch(). 'manual' does not install Java automatically. You can use Java.download() to install Java manually. | No (default is 'auto') |
java.absolutePath | string | The absolute path to the Java executable. If you use a manual installation of Java with a custom path, you can set it here. Be careful to indicate the correct path depending on the operating system of the user. If you don’t install Java (automatically or manually), set this value to 'java' to use the Java installed on the user’s computer.Attention! This property overrides the java.relativePath property. | No (default is undefined) |
java.relativePath | string | The path (relative to the game folder) to the Java executable. If you use a manual installation of Java with a custom path, or if you don’t install Java, (automatically or manually) use java.absolutePath property instead.Attention! This property is ignored if java.absolutePath is set. | No (default is 'runtime/jre-X/bin/java' where X is the major version of Java) |
java.args | string[] | Use this option only if you know what you are doing! Add custom arguments to Java Virtual Machine (JVM). Please don’t try to patch Log4j with this option! The launcher will automatically patch Log4j if needed. | No |
window.width | number | The width of the Minecraft window. | No (default is 854) |
window.height | number | The height of the Minecraft window. | No (default is 480) |
window.fullscreen | boolean | Should the Minecraft window be fullscreen? | No (default is false) |
memory.min | number | The minimum memory (RAM), in MB, allocated to Minecraft. | No (default is 512) |
memory.max | number | The maximum memory (RAM), in MB, allocated to Minecraft. | No (default is 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.