Arguments System

Overview

The arguments system builds the complete command-line arguments for launching Minecraft. It handles JVM arguments, game arguments, and variable substitution.

Placeholders (Variable Substitution)

The launch system uses placeholders that are replaced with actual values at launch time.

Authentication Placeholders

Placeholder
Description
Example Value

${auth_player_name}

Player username

"Player123"

${auth_uuid}

Player UUID

"550e8400-e29b-41d4-a716-446655440000"

${auth_access_token}

Access token

"eyJhbGc..." or "0" (offline)

${auth_xuid}

Xbox User ID

"2535405290..." or "0"

${clientid}

Client ID

"{client-id}"

${user_type}

User type

"legacy" or "msa"

${user_properties}

User properties JSON

"{}"

Directory Placeholders

Placeholder
Description
Example Path

${game_directory}

Game instance directory

/home/user/.local/share/MyLauncher/instance

${assets_root}

Assets root directory

/home/user/.local/share/MyLauncher/assets

${natives_directory}

Native libraries directory

/tmp/natives-xxxxx

${library_directory}

Libraries directory

/home/user/.local/share/MyLauncher/libraries

${classpath}

Java classpath

/path/lib1.jar:/path/lib2.jar:...

${classpath_separator}

Platform separator

: (Linux/macOS) or ; (Windows)

Version Placeholders

Placeholder
Description
Example Value

${version_name}

Minecraft version

"1.21.1"

${version_type}

Version type

"release" or "snapshot"

${assets_index_name}

Asset index ID

"16"

${launcher_name}

Launcher name

"MyLauncher"

${launcher_version}

Launcher version

"0.8.6"

JVM Arguments

Default JVM Arguments

When no JVM arguments are specified in version metadata, these defaults are used:

Custom JVM Arguments

You can customize JVM arguments using the with_jvm_options() builder:

Common JVM Options:

Option
Description
Example

-Xmx

Maximum heap size

"4G", "8G"

-Xms

Initial heap size

"2G", "4G"

-XX:+UseG1GC

Use G1 garbage collector

""

-XX:+UseZGC

Use Z garbage collector (Java 15+)

""

-XX:MaxGCPauseMillis

Target max GC pause time (ms)

"50", "100"

-XX:G1HeapRegionSize

G1 heap region size

"32M", "16M"

-Dfile.encoding

File encoding

"UTF-8"

-Djava.net.preferIPv4Stack

Prefer IPv4

"true"

Critical JVM Arguments (Always Present)

These arguments are automatically added if not present:

  1. -Djava.library.path=${natives_directory}

    • Required for LWJGL native libraries

    • Automatically set to temporary natives directory

  2. -Dminecraft.launcher.brand=${launcher_name}

    • Identifies the launcher

    • Set from AppState organization name

  3. -Dminecraft.launcher.version=${launcher_version}

    • Launcher version

    • Set from package version

  4. -cp ${classpath}

    • Java classpath with all libraries

    • Must be the last JVM argument before main class

Game Arguments

Standard Game Arguments

Game arguments are provided by the version metadata:

Custom Game Arguments

You can add or override game arguments:

Common Game Options:

Option
Description
Example

--width

Window width

"1920", "2560"

--height

Window height

"1080", "1440"

--fullscreen

Fullscreen mode

"true", "false"

--quickPlayPath

Quick play server file

"servers.dat"

--quickPlaySingleplayer

Quick play world

"New World"

--quickPlayMultiplayer

Quick play server

"mc.hypixel.net"

--quickPlayRealms

Quick play realm

"realm-name"

--demo

Demo mode

"true"

--server

Auto-connect server

"play.example.com"

--port

Server port

"25565"

Complete Argument Flow

1. Variable Map Creation

All placeholders are populated with actual values:

2. Argument Overrides Applied

Custom options override default variables:

3. Variable Substitution

Placeholders in arguments are replaced:

4. JVM Arguments Processing

5. Final Command Assembly

Example:

Argument Removal

You can remove specific arguments:

Platform-Specific Arguments

Classpath Separator

Automatically set based on platform:

  • Windows: ; (semicolon)

  • Linux/macOS: : (colon)

Natives Directory

Platform-specific native libraries:

  • Windows: lwjgl-3.3.3-natives-windows.jar

  • Linux: lwjgl-3.3.3-natives-linux.jar

  • macOS: lwjgl-3.3.3-natives-macos.jar

Argument Constants

Available in lighty_launch::arguments:

Constant to Placeholder Mapping

Constant
Placeholder
Value

KEY_AUTH_PLAYER_NAME

${auth_player_name}

"auth_player_name"

KEY_AUTH_UUID

${auth_uuid}

"auth_uuid"

KEY_AUTH_ACCESS_TOKEN

${auth_access_token}

"auth_access_token"

KEY_AUTH_XUID

${auth_xuid}

"auth_xuid"

KEY_CLIENT_ID

${clientid}

"clientid"

KEY_USER_TYPE

${user_type}

"user_type"

KEY_USER_PROPERTIES

${user_properties}

"user_properties"

KEY_VERSION_NAME

${version_name}

"version_name"

KEY_VERSION_TYPE

${version_type}

"version_type"

KEY_GAME_DIRECTORY

${game_directory}

"game_directory"

KEY_ASSETS_ROOT

${assets_root}

"assets_root"

KEY_NATIVES_DIRECTORY

${natives_directory}

"natives_directory"

KEY_LIBRARY_DIRECTORY

${library_directory}

"library_directory"

KEY_ASSETS_INDEX_NAME

${assets_index_name}

"assets_index_name"

KEY_LAUNCHER_NAME

${launcher_name}

"launcher_name"

KEY_LAUNCHER_VERSION

${launcher_version}

"launcher_version"

KEY_CLASSPATH

${classpath}

"classpath"

KEY_CLASSPATH_SEPARATOR

${classpath_separator}

"classpath_separator"

Usage example:

Complete Example

Last updated