### HeadlessMc Specifics Command Examples Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Examples demonstrating the output of the 'specifics' command when listing available mods and when installing a specific mod for a given version. ```bash > specifics name version url hmc-specifics 2.2.1 https://github.com/headlesshq/hmc-specifics/releases/download/ pc-runtime-test 4.1.0 https://github.com/headlesshq/mc-runtime-test/releases/download/ hmc-optimizations 0.4.0 https://github.com/headlesshq/hmc-optimizations/releases/download/ ``` ```bash > specifics fabric:1.21.5 hmc-specifics Installed hmc-specifics-2.2.0 for fabric-loader-0.16.14-1.21.5 successfully. ``` -------------------------------- ### HeadlessMc Versions Command Example Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md An example showing the output of the 'versions' command, listing Minecraft client IDs, names, and their parent versions. ```bash > versions id name parent 0 1.12.2 1 1.12.2-forge-14.23.5.2860 1.12.2 ... ``` -------------------------------- ### List Installed Plugins Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Display a list of all installed plugins and their descriptions. ```bash plugins ``` ```bash > plugins name description meteor Adds a command for downloading meteor. ``` -------------------------------- ### Log Level Command Examples Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Shows how to set the log level to SEVERE and ALL, illustrating the output for each level. ```bash > loglevel SEVERE [16:22:40] [main/OFF] [LogLevelCommand]: Logging with Level: OFF [16:22:40] [main/SEVERE] [LogLevelCommand]: Logging with Level: SEVERE > loglevel ALL [16:22:57] [main/OFF] [LogLevelCommand]: Logging with Level: OFF [16:22:57] [main/SEVERE] [LogLevelCommand]: Logging with Level: SEVERE [16:22:57] [main/WARNING] [LogLevelCommand]: Logging with Level: WARNING [16:22:57] [main/INFO] [LogLevelCommand]: Logging with Level: INFO [16:22:57] [main/CONFIG] [LogLevelCommand]: Logging with Level: CONFIG [16:22:57] [main/FINE] [LogLevelCommand]: Logging with Level: FINE [16:22:57] [main/FINER] [LogLevelCommand]: Logging with Level: FINER [16:22:57] [main/FINEST] [LogLevelCommand]: Logging with Level: FINEST [16:22:57] [main/ALL] [LogLevelCommand]: Logging with Level: ALL ``` -------------------------------- ### Memory Statistics Example Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md An example output of the memory command, showing the current memory utilization. ```bash > memory -Used: 21mb, (0.71%) -Free: 167mb -Total: 188mb -Max: 2988mb ``` -------------------------------- ### Login Command Examples Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Demonstrates interactive login scenarios, including initiating a login, cancelling a process, and handling password entry. ```bash > login Starting login process 0, enter 'login -cancel 0' to cancel the login process. Go to https://www.microsoft.com/link?otc=CQBAQ46Q > login -cancel 0 Cancelled login process 0. > login test@test.com Enter your password or type 'abort' to cancel the login process. > abort Aborting login process. ``` -------------------------------- ### Gradle Installation Source: https://github.com/headlesshq/headlessmc/blob/main/docs/dev-getting-started.md Configure your Gradle project with this repository and dependency to use HeadlessMC. ```groovy repositories { maven { url 'https://3arthqu4ke.github.io/maven' } } dependencies { implementation 'io.github.headlesshq.headlessmc:headlessmc-launcher:$VERSION' ``` -------------------------------- ### List and Install Forge Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Lists available Forge versions or installs a specific Forge version for a Minecraft version. Requires downloading the Forge installer jar and running it with the correct Java version. ```bash forge forge ``` ```bash > forge Forge versions: version uid 1.21.5 55.0.14 1.21.5 55.0.12 1.21.5 55.0.11 ... ``` ```bash > forge 1.21.5 Installing Forge 1.21.5-55.0.14 ... Forge 1.21.5-55.0.14 installed successfully! ``` ```bash > forge 1.21.5 --uid 55.0.12 Installing Forge 1.21.5-55.0.12 ... Forge 1.21.5-55.0.12 installed successfully! ``` -------------------------------- ### Gradle Installation (Jitpack) Source: https://github.com/headlesshq/headlessmc/blob/main/docs/dev-getting-started.md Configure your Gradle project with Jitpack and add this dependency to use HeadlessMC. ```groovy repositories { maven { url 'https://jitpack.io' } } dependencies { implementation 'com.github.3arthqu4ke.headlessmc:headlessmc-launcher:$VERSION' ``` -------------------------------- ### Launch Minecraft with Modloader and Specifics Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md This example demonstrates launching a specific Minecraft version with a modloader (e.g., fabric) and enabling the '-specifics' flag for automatic download of hmc-specifics. It also includes JVM arguments for headless mode and game arguments for quick play multiplayer. ```bash > launch fabric:1.21.5 ... ``` ```bash > launch fabric:1.21.5 -specifics -lwjgl --jvm "-Djava.awt.headless=true -Xmx2G" --game-args "--quickPlayMultiplayer 127.0.0.1:25565" ... ``` -------------------------------- ### Maven Installation Source: https://github.com/headlesshq/headlessmc/blob/main/docs/dev-getting-started.md Add this repository and dependency to your Maven project to include HeadlessMC. ```xml 3arthqu4ke https://3arthqu4ke.github.io/maven io.github.headlesshq.headlessmc headlessmc-launcher $VERSION ``` -------------------------------- ### Maven Installation (Jitpack) Source: https://github.com/headlesshq/headlessmc/blob/main/docs/dev-getting-started.md Use Jitpack as a repository and add this dependency to your Maven project for HeadlessMC. ```xml Jitpack https://jitpack.io com.github.3arthqu4ke.headlessmc headlessmc-launcher $VERSION ``` -------------------------------- ### Command Flags and Options Example Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Illustrates the syntax for using flags (single hyphen) and options (double hyphen) with arguments in HeadlessMc commands. ```bash > command -flag1 -flag2 --option1 "Some option" --option2 1234 ``` -------------------------------- ### Get Help for Commands Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Displays available commands in HeadlessMc or provides detailed information about a specific command and its arguments. ```bash help help help ``` ```bash > help command description args account List accounts or chose the primary account. config Manage your configs. -refresh download Downloads a version. -id -refresh -snapshot -release -other ... ``` ```bash > help config config : Manage your configs. arg description -refresh Reloads all configs from the disk. ``` ```bash > help config -refresh config -refresh: Reloads all configs from the disk. ``` -------------------------------- ### Install Fabric Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Installs Fabric for a specified Minecraft version. Ensure you have the correct Java version installed. Legacy Fabric is used for versions older than 1.14. ```bash fabric ``` ```bash > fabric 1.21.5 Installing Fabric for version 1.21.5... Loading Fabric Installer: 1.0.3 ... Installed Fabric for: 1.21.5 successfully! ``` ```bash > fabric 1.21.5 --uid 0.16.13 --jvm -Xmx2G --java 17 Installing Fabric for version 1.21.5... ... Downloading library net.fabricmc:fabric-loader:0.16.13 Done Installed Fabric for: 1.21.5 successfully! ``` -------------------------------- ### Manage Neoforge Versions Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md List available Neoforge versions or install a specific version for a Minecraft version. This involves downloading the Neoforge installer jar and running it with the correct Java version. ```bash neoforge neoforge ``` ```bash > neoforge NeoForge versions: version uid 1.20.1 47.1.106 1.20.1 47.1.105 1.20.1 47.1.104 ... > neoforge 1.21.5 Installing NeoForge 1.21.5-21.5.66-beta ... NeoForge 1.21.5-21.5.66-beta installed successfully! > neoforge 1.21.5 --uid 21.5.65-beta Installing NeoForge 1.21.5-21.5.65-beta ... NeoForge 1.21.5-21.5.65-beta installed successfully! ``` -------------------------------- ### Launch a Server Source: https://github.com/headlesshq/headlessmc/blob/main/docs/servers.md Starts a specified server. HeadlessMc automatically adds the 'nogui' argument to launch the server without a graphical user interface. ```bash > server launch paper-1.21.5-76 ``` -------------------------------- ### Install Modloader (Forge) Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Installs a specified modloader for a given Minecraft version. The 'versions' command will then show the modded version. ```bash > forge 1.12.2 Installing Forge 1.12.2-14.23.5.2860 ... Forge 1.12.2-14.23.5.2860 installed successfully! > versions id name parent 0 1.12.2 1 1.12.2-forge-14.23.5.2860 1.12.2 ... ``` -------------------------------- ### List Client Mods Source: https://github.com/headlesshq/headlessmc/blob/main/docs/mods.md Lists all installed client-side mods for a given version. Displays mod ID, name, description, and authors. ```bash > mod list 1 id name description authors 0 fabric-api Core API module providing key hooks and intercompatibility features. FabricMC ``` -------------------------------- ### Install Java in Termux Source: https://github.com/headlesshq/headlessmc/blob/main/README.md Installs Java within the Termux environment on Android. Ensure to download the wrapper JAR and disable JLine for compatibility. ```bash apt update && apt upgrade apt install openjdk- ``` -------------------------------- ### Command Argument Parsing Examples Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Demonstrates how HeadlessMc parses command arguments, including handling spaces and escaped characters within arguments. ```bash > some command Read as: ['some', 'command'] ``` ```bash > "some command" Read as: ['some command'] ``` ```bash > "some command \"with a sentence\"" Read as: ['some command "with a sentence"'] ``` -------------------------------- ### Run Multiple Commands Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Execute several commands sequentially. Useful when starting HeadlessMc with a single command argument. ```bash multi ... ``` ```bash > multi java "versions -refresh" version path current 23 C:/Users/me/.jdks/graalvm-ce-23.0.2 <------ id name parent 0 1.12.2 ... ``` -------------------------------- ### List Server Mods Source: https://github.com/headlesshq/headlessmc/blob/main/docs/mods.md Lists all installed server-side mods for a given server instance. Displays mod ID, name, description, and authors. ```bash > server mod list 0 id name description authors 0 voicechat A working voice chat in Minecraft Max Henkel, Matthew Wells ``` -------------------------------- ### Install hmc-specifics Mod Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Installs the hmc-specifics mod for a specified Minecraft version and mod loader. Ensure the correct version and loader are provided. ```bash > versions id name parent 0 1.21.5 1 neoforge-21.5.66-beta 1.21.5 > specifics 1 hmc-specifics Installed hmc-specifics-2.2.0 for neoforge-21.5.66-beta successfully. > launch 1 ... ``` -------------------------------- ### In-Memory Launching Classloading with LauncherWrapper Source: https://github.com/headlesshq/headlessmc/blob/main/docs/in-memory.md Illustrates the classloading hierarchy for launching Minecraft in-memory using HeadlessMc and LauncherWrapper. This setup ensures separate classloading for HeadlessMc and its plugins. ```mermaid graph TD A[SystemClassloader] --> B[LauncherWrapper]; B --> C[PluginClassloader]; C --> D[HeadlessMc]; A[JVM Classloader] --> E[URLClassloader]; E --> F[Modloader]; F --> G[Minecraft]; ``` -------------------------------- ### List Mods for Minecraft Version Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Lists all mods currently installed for a given Minecraft version. ```bash mod list ``` ```text > mod list fabric:1.21.5 id name description authors 0 fabric-api Core API module providing key hooks and intercompatibility features. FabricMC ``` -------------------------------- ### Custom Redirection for Buffer Creation Source: https://github.com/headlesshq/headlessmc/blob/main/headlessmc-lwjgl/README.md An example of a custom redirection for `BufferUtils.createFloatBuffer`. This ensures that a new FloatBuffer is created with the specified size when called. ```java manager.redirect("Lorg/lwjgl/BufferUtils;createFloatBuffer(I)"Ljava/nio/FloatBuffer;", (obj, desc, type, args) -> FloatBuffer.wrap( new float[(int) args[0]])); ``` -------------------------------- ### LWJGL Method Transformation Example Source: https://github.com/headlesshq/headlessmc/blob/main/headlessmc-lwjgl/README.md This is how LWJGL methods are transformed to call the RedirectionApi. It replaces the original method body with an invocation to `RedirectionApi.invoke`. ```java public method(... args) { return () RedirectionApi.invoke(this, ";method()", .class, args); } ``` -------------------------------- ### Configure Java Versions for HeadlessMc Source: https://github.com/headlesshq/headlessmc/blob/main/README.md Specify Java versions for HeadlessMc to use by adding a semicolon-separated list to the config.properties file. This is useful when Java is installed in non-standard locations. ```properties hmc.java.versions=C:/Program Files/Java/jre-/bin/java;C:/Program Files/Java/jdk-/bin/java ``` -------------------------------- ### HeadlessMc Specifics Command Usage Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md This command is used to manage HeadlessMc version-specific mods. It can be used without arguments to list available specifics, or with a version and mod name to install a specific mod. ```bash specifics specifics hmc-specifics specifics hmc-optimizations specifics hmc-runtime-test ``` -------------------------------- ### Config Command Usage Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Demonstrates how to manage configuration files, refresh configurations, and set/get Java SystemProperties. ```bash config config config -refresh config --property ``` ```bash > config -refresh ``` ```bash > config id name 0 config ``` ```bash > config 0 Loading config config... ``` ```bash > config --property hmc.assets.retry=3 Set property hmc.assets.retry to 3 ``` ```bash > config --property hmc.assets.retry hmc.assets.retry = 3 ``` ```bash > config --property name value file.encoding UTF-8 file.separator / java.class.path ... ``` -------------------------------- ### Initialize HeadlessMC Web with Cheerpj Source: https://github.com/headlesshq/headlessmc/blob/main/headlessmc-web/page/index.html Initializes Cheerpj, creates the display element, runs the HeadlessMC JAR, and sets up resizing. Ensure the Cheerpj library is available. ```javascript await cheerpjInit({ clipboardMode: "system" }); const element = document.getElementById("container"); const rect = element.getBoundingClientRect(); const width = rect.width; const height = rect.height; cheerpjCreateDisplay(-1, -1, element); const lib = await cheerpjRunLibrary("/app/headlessmc/cheerpj/headlessmc-web.jar"); const Resizer = await lib.io.github.headlesshq.headlessmc.web.cheerpj.Resizer; const resizer = await Resizer.getInstance(); await resizer.setVersion("1.0.0"); await resizer.setSize(width, height); const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) { const {width, height} = entry.contentRect; resizer.setSize(width, height).catch(ignored => { /* Java code still running, check for a missing 'await' (Can't, doesn't matter!) */ }); } }); resizeObserver.observe(element); const Main = await lib.io.github.headlesshq.headlessmc.web.cheerpj.Main; await Main.init(); console.log("Main.init() finished.") ``` -------------------------------- ### Make Linux Executable and Run Source: https://github.com/headlesshq/headlessmc/blob/main/docs/getting-started.md Make the Linux launcher executable and run it from the console. ```sh chmod +x headlessmc-launcher-linux-x64 ./headlessmc-launcher-linux-x64 ``` -------------------------------- ### Launch Server with Custom Arguments Source: https://github.com/headlesshq/headlessmc/blob/main/docs/servers.md Launch a server with custom JVM and game arguments. This allows for fine-tuning memory allocation and game settings. ```bash > server launch paper-1.21.5-76 --jvm "-Xms10G -Xmx10G" --game-args "bonusChest eraseCache" ``` -------------------------------- ### Server Command Usage Overview Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Provides a general overview of available server management commands. ```bash server server add server add server add server add server list server launch server remove server eula server eula accept server mod server mod add server mod remove server mod list server mod search server mod search ``` -------------------------------- ### Make MacOS Executable and Run Source: https://github.com/headlesshq/headlessmc/blob/main/docs/getting-started.md Make the macOS ARM64 launcher executable and run it from the console. ```sh chmod +x headlessmc-launcher-macos-arm64 ./headlessmc-launcher-macos-arm64 ``` -------------------------------- ### List Downloaded Versions Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Displays a table of all downloaded client versions, including their IDs, names, and parent versions. IDs and names can be used to specify versions for launching. ```bash > versions id name parent 0 1.20.6 1 1.21.5 2 fabric-loader-0.16.14-1.21.5 1.21.5 ``` -------------------------------- ### Get Item Tooltip Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Retrieves the tooltip information for a specific item in the inventory using its slot number. ```bash > gui --tooltip 36 Diamond Sword Sharpness V Unbreaking III Mending When in Main Hand: 7 Attack Damage 1.6 Attack Speed ``` -------------------------------- ### Connect to a Minecraft Server Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Use the `connect` command to establish a connection to a Minecraft server. Ensure the server address is correctly formatted. ```bash > connect hypixel.net ``` -------------------------------- ### Manage Server EULA Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md View or accept the End User License Agreement (EULA) for a server. This may launch the server if no EULA is present. ```bash server eula server eula accept ``` ```bash > server eula paper-1.21.5-77 #By changing the setting below to TRUE you are indicating your agreement to our EULA (https://aka.ms/MinecraftEULA). #Wed May 14 19:19:35 AEST 2025 eula=false > server eula paper-1.21.5-77 accept EULA accepted. > server eula paper-1.21.5-77 ... eula=true ``` -------------------------------- ### Account Command Usage Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Shows how to list available Minecraft accounts and select an account to use for launching the game. ```bash account account ``` ```bash > account id name 0 3arthqu4ke 1 SomeOtherAccount > account 1 ... Account SomeOtherAccount selected. ``` -------------------------------- ### Launch Minecraft Client Version Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md This snippet shows the basic syntax for launching a Minecraft client version using the launch command. It requires specifying the version to launch. ```bash launch ``` -------------------------------- ### Run Minecraft Client in GitHub Actions Source: https://github.com/headlesshq/headlessmc/blob/main/docs/dev-ci-cd.md This GitHub Actions workflow demonstrates how to set up Java, build a mod, stage it, and then run the Minecraft client using the mc-runtime-test action. ```yaml name: Run Minecraft Client on: workflow_dispatch: env: java_version: 21 jobs: run: runs-on: ubuntu-latest steps: - name: Install Java uses: actions/setup-java@v4 with: java-version: ${{ env.java_version }} distribution: "temurin" - name: [Example] Build mod run: ./gradlew build - name: [Example] Stage mod for test client run: | mkdir -p run/mods cp build/libs/<your-mod>.jar run/mods - name: Run MC test client uses: headlesshq/mc-runtime-test@4.10 with: mc: 1.21.4 modloader: fabric regex: .*fabric.* mc-runtime-test: fabric java: ${{ env.java_version }} ``` -------------------------------- ### Setting System Properties for Configuration Source: https://github.com/headlesshq/headlessmc/blob/main/docs/configuration.md Demonstrates how to set HeadlessMc configuration properties using Java system properties when launching the application. This is an alternative to using the config.properties file. ```bash java -Dhmc.some.property=value -jar headlessmc-launcher.jar ``` -------------------------------- ### Accept Server EULA Source: https://github.com/headlesshq/headlessmc/blob/main/docs/servers.md Accept the End User License Agreement for a specific server. This is often required before a server can be launched. ```bash > server eula paper-1.21.5-76 accept ``` -------------------------------- ### Run Windows Launcher Source: https://github.com/headlesshq/headlessmc/blob/main/docs/getting-started.md Execute the Windows x64 launcher from PowerShell. ```powershell .\headlessmc-launcher-windows-x64.exe ``` -------------------------------- ### Download Windows Launcher via Curl Source: https://github.com/headlesshq/headlessmc/blob/main/docs/getting-started.md Download the Windows x64 launcher executable using curl in Command Prompt. ```powershell curl.exe -L --output headlessmc-launcher.exe --url https://github.com/headlesshq/headlessmc/releases/download/$VERSION/headlessmc-launcher-windows-x64.exe ``` -------------------------------- ### Download Linux Launcher via Curl Source: https://github.com/headlesshq/headlessmc/blob/main/docs/getting-started.md Download the Linux x64 launcher executable using curl. ```sh curl -L https://github.com/headlesshq/headlessmc/releases/download/$VERSION/headlessmc-launcher-linux-x64 -o headlessmc-launcher ``` -------------------------------- ### Run HeadlessMc Launcher JAR Source: https://github.com/headlesshq/headlessmc/blob/main/docs/getting-started.md Execute the HeadlessMc launcher JAR file using Java. ```shell java -jar headlessmc-launcher.jar ``` -------------------------------- ### Login Command Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Initiates the login process for your Minecraft account. Follow the provided URL to complete authentication. ```bash > login Starting login process 0, enter 'login -cancel 0' to cancel the login process. Go to https://www.microsoft.com/link?otc=... ``` -------------------------------- ### List All Servers Source: https://github.com/headlesshq/headlessmc/blob/main/docs/servers.md This command displays a table of all servers managed by HeadlessMc, including their ID, type, version, and name. ```bash > server list id type version name 0 paper 1.21.5 paper-1.21.5-76 ``` -------------------------------- ### List and Download Java Versions Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md The java command is used to list available Java versions and download specific versions or distributions. Use the -current flag to display the current Java version and -jdk to download a JDK instead of a JRE. ```bash java java java ``` ```bash > java version path current 21 C:/Users/me/IdeaProjects/headlessmc/HeadlessMC/java/jdk-21.0.7+6-jre 8 C:/Users/me/IdeaProjects/headlessmc/HeadlessMC/java/jdk8u452-b09-jre 23 C:/Users/me/.jdks/graalvm-ce-23.0.2 <------ ``` ```bash > java 17 Downloading Java 17 100% [=======================] 43/43mb (0:00:02 / 0:00:00) ``` ```bash > java 17 temurin Downloading Java 17 100% [=======================] 43/43mb (0:00:02 / 0:00:00) ``` ```bash > java 17 temurin -jdk Downloading Java 17 19% [==== ] 36/190mb (0:00:03 / 0:00:12) ``` -------------------------------- ### Add and Manage Minecraft Servers Source: https://github.com/headlesshq/headlessmc/blob/main/README.md Commands for adding, listing, accepting EULAs, and launching Minecraft servers with specified modloaders and versions. ```bash > server add paper 1.21.5 Added paper server: paper-1.21.5-54. > server list id type version name 0 paper 1.21.5 paper-1.21.5-54 > server eula paper-1.21.5-54 -accept ... > server launch paper-1.21.5-54 --jvm "-Xmx10G -XX:+UseG1GC <...>" ``` -------------------------------- ### Launch Vanilla Minecraft Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Launches a specific vanilla version of Minecraft. Ensure the version is already downloaded or will be downloaded automatically. ```bash launch 1.21.5 ``` -------------------------------- ### Launch Minecraft by Version Name Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Launches Minecraft using the full name of a downloaded version, as shown in the 'versions' command output. ```bash launch fabric-loader-0.16.14-1.21.5 ``` -------------------------------- ### Download Command Usage Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Explains how to list and download specific versions of Minecraft, including filtering by version type. ```bash download download ``` ```bash > download id name type 0 25w15a snapshot 1 25w14craftmine snapshot 2 1.21.5 release 3 1.21.5-rc2 snapshot ... ``` ```bash > download 1.20.6 Downloading 1.20.6... Download successful! ``` ```bash > download 1.20.6 1.20.6 has already been downloaded, download anyways? (y/n) > n ``` ```bash > download fabric:1.20.6 Installing Fabric for version 1.20.6... ``` ```bash download -snapshot -other id name type 7 1.21.5 release 23 1.21.4 release 33 1.21.3 release ... ``` -------------------------------- ### List Available Commands Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Displays a list of all available commands and their descriptions after the hmc-specifics mod is loaded in Minecraft. ```bash command description quit Quits the running game. help Information about commands. render Outputs all text rendered on the screen. click Performs clicks in the Gui. gui Dumps the currently displayed screen. text Set text in text fields. close Closes the current screen, if ingame. menu Opens the menu if you are ingame. memory Displays Memory stats. connect Connects you to a server. disconnect Disconnects you from a server. login Logs you into an account. key Allows you to press keys. msg Sends a chat message. / Sends a chat command. . Sends a chat message. ``` -------------------------------- ### Dump New World Creation Screen Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Outputs the GUI structure for the world creation screen after clicking the 'Singleplayer' button. This includes details on buttons, text fields, and other interactive elements. ```bash > gui Screen: net.minecraft.client.gui.screens.worldselection.CreateWorldScreen Buttons: id text x y w h on type 0 Cancel 217 214 150 20 1 Button 1 Create New World 59 214 150 20 1 Button TextFields: id text x y w h type 2 New World 109 48 208 20 EditBox Other: id text x y w h type 3 World Name 109 35 55 9 StringWidget 4 Game Mode: Survival 108 76 210 20 CycleButton 5 Difficulty: Normal 108 104 210 20 CycleButton 6 Allow Commands: OFF 108 132 210 20 CycleButton ``` -------------------------------- ### List Minecraft Servers Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Lists all configured Minecraft servers with their details. ```bash server list ``` ```bash > server list id type version name 0 paper 1.21.5 paper-1.21.5-77 ``` -------------------------------- ### Mod Command Usage Overview Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Provides a general overview of the available subcommands for managing mods. ```bash mod mod add mod remove mod list mod search mod search ``` -------------------------------- ### Launch Minecraft Server Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Launches a specified Minecraft server. Supports most flags and options from the general launch command. ```bash server launch ``` ```bash > server launch paper-1.21.5-77 [19:28:21 INFO]: Done (25.376s)! For help, type "help" > stop [19:28:30 INFO]: Stopping the server ... ``` -------------------------------- ### Add a Paper Server Source: https://github.com/headlesshq/headlessmc/blob/main/docs/servers.md Use this command to add a new Paper server, specifying the type, version, and a unique name. If the version is omitted, the latest Minecraft version will be used. ```bash > server add paper 1.21.5 Adding paper server for 1.21.5 Added paper server: paper-1.21.5-76. ``` -------------------------------- ### Launch Minecraft Client Source: https://github.com/headlesshq/headlessmc/blob/main/README.md Launches the Minecraft game client with a specified modloader and version. Use the `-lwjgl` flag for headless mode. ```bash java -jar headlessmc-launcher.jar ./headlessmc-launcher-linux ``` ```bash launch fabric:1.21.4 -lwjgl ``` -------------------------------- ### Add Minecraft Server Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Adds a new Minecraft server. Specify type, version, name, and optionally build. ```bash server add server add server add server add ``` ```bash >server add paper 1.21.5 Adding paper server for 1.21.5 Added paper server: paper-1.21.5-77. ``` -------------------------------- ### Send Chat Messages and Commands Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Demonstrates sending chat messages using '.' or 'msg' and executing game commands with '/'. ```bash > . Hello World! [21:05:04] [Render thread/INFO] [minecraft/ChatComponent]: [CHAT] <3arthqu4ke> Hello World! ``` ```bash > /gamemode creative [21:05:31] [Render thread/INFO] [minecraft/ChatComponent]: [System] [CHAT] Set own game mode to Creative Mode ``` -------------------------------- ### Launch Minecraft by Version ID Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Launches Minecraft using the numerical ID of a downloaded version, as shown in the 'versions' command output. ```bash launch 1 ``` -------------------------------- ### Download MacOS Launcher via Curl Source: https://github.com/headlesshq/headlessmc/blob/main/docs/getting-started.md Download the macOS ARM64 launcher executable using curl. ```sh curl -L https://github.com/headlesshq/headlessmc/releases/download/$VERSION/headlessmc-launcher-macos-arm64 -o headlessmc-launcher ``` -------------------------------- ### Simulate Key Press for Screenshot Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Use the `key` command to simulate a key press, which can be used to take screenshots. The output will indicate the save location of the screenshot. ```bash > key f2 [21:20:51] [Render thread/INFO] [minecraft/ChatComponent]: [System] [CHAT] Saved screenshot as 2025-05-14_21.20.50.png ``` -------------------------------- ### Dump Current GUI Screen Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Outputs a detailed representation of the currently displayed GUI screen in Minecraft, including buttons and text fields. ```bash > gui Screen: net.minecraft.client.gui.screens.TitleScreen Buttons: id text x y w h on type 0 Multiplayer 113 116 200 20 1 Button 1 Singleplayer 113 92 200 20 1 Button 2 Minecraft Realms 113 140 200 20 1 Button 3 Mods 113 164 200 20 1 ModsButton 4 Language... 89 200 20 20 1 CenteredIcon 5 Options... 113 200 98 20 1 Button 6 Quit Game 215 200 98 20 1 Button 7 Accessibility Settings... 317 200 20 20 1 CenteredIcon 8 Copyright Mojang AB. Do not distribute! 229 230 196 10 1 PlainTextButton TextFields: id text x y w h type - - - - - - - ``` -------------------------------- ### HeadlessMc Versions Command Usage Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md This command lists all available Minecraft client versions. Use the -refresh flag to update the list if new versions have been added. ```bash versions ``` -------------------------------- ### Launch Minecraft in Headless Mode Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Launches the Minecraft client without a GUI by patching LWJGL. This is useful for running on servers or in CI/CD environments. ```bash launch -lwjgl ``` -------------------------------- ### HeadlessMc Test Framework Configuration Source: https://github.com/headlesshq/headlessmc/blob/main/README.md JSON configuration for the built-in command testing framework. Defines steps to test server or client behavior, including message matching and command sending. ```json { "name": "Server Test", "steps": [ { "type": "ENDS_WITH", "message": "For help, type \"help\"" }, { "type": "SEND", "message": "stop", "timeout": 120 } ] } ``` -------------------------------- ### Open Inventory Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Opens the player's inventory screen in Minecraft. ```bash > menu -inventory Opening inventory... ``` -------------------------------- ### Pull and Run HeadlessMc Docker Image Source: https://github.com/headlesshq/headlessmc/blob/main/docs/getting-started.md Pull the latest HeadlessMc Docker image and run it interactively. ```shell docker pull 3arthqu4ke/headlessmc:latest docker run -it 3arthqu4ke/headlessmc:latest ``` -------------------------------- ### Forge/NeoForge Classloading for In-Memory Launching Source: https://github.com/headlesshq/headlessmc/blob/main/docs/in-memory.md Details the classloading structure when launching Minecraft with Forge or NeoForge in-memory via HeadlessMc. This diagram highlights the distinct classloaders used for Forge/NeoForge. ```mermaid graph TD A[SystemClassloader] --> B[LauncherWrapper]; B --> C[PluginClassloader]; C --> D[HeadlessMc]; A[JVM Classloader] --> E[BootstrapLauncherClassloader]; E --> F[Forge/Neoforge]; F --> G[Minecraft]; ``` -------------------------------- ### Execute Single Command (Java) Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Launches HeadlessMc using Java and executes a single specified command, then exits. This is useful for scripting or automation. ```shell java -jar headlessmc-launcher.jar --command ``` -------------------------------- ### Render All Strings Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Dumps all strings currently rendered by the Minecraft client, including those not visible via the `gui` command, such as potion effects. ```text {x=177.0, y=268.0, text=64} {x=238.0, y=243.0, text=8} {x=97.0, y=6.0, text=Crafting} {x=358.0, y=62.0, text=Regeneration II} {x=358.0, y=72.0, text=00:13} {x=358.0, y=95.0, text=Absorption IV} {x=358.0, y=105.0, text=01:53} {x=358.0, y=128.0, text=Resistance} {x=358.0, y=138.0, text=04:53} {x=358.0, y=161.0, text=Fire Resistance} {x=358.0, y=171.0, text=04:53} ``` -------------------------------- ### Click GUI Element Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Simulates a mouse click on a specified GUI element by its ID. The coordinates and button type are also outputted. ```bash > click 1 Clicking at x=213, y=102, button=0 ``` -------------------------------- ### Name a New World Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Use the `text` command to set the name for a new Minecraft world before creation. ```bash > text 2 "Name for our world" ``` -------------------------------- ### Create and Join a New World Source: https://github.com/headlesshq/headlessmc/blob/main/docs/specifics.md Initiates the creation and joining of a new Minecraft world by clicking the 'Create New World' button. ```bash > click 1 Clicking at x=134, y=224, button=0 [19:54:53] [Server thread/INFO] [minecraft/IntegratedServer]: Starting integrated minecraft server version 1.21.5 ... [19:55:03] [Server thread/INFO] [minecraft/PlayerList]: 3arthqu4ke[local:E:62792f56] logged in with entity id 26 at (-4.5, 58.0, 15.5) [19:55:03] [Server thread/INFO] [minecraft/MinecraftServer]: 3arthqu4ke joined the game ... > gui Minecraft is currently not displaying a Gui. ``` -------------------------------- ### Execute Single Command (Linux/macOS) Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Launches HeadlessMc and executes a single specified command, then exits. This is useful for scripting or automation. ```shell ./headlessmc-launcher-native --command ``` -------------------------------- ### Configure Headless Settings Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Disables the accessibility screen and 'pauseOnLostFocus' setting for headless Minecraft launches to prevent potential issues. ```properties pauseOnLostFocus:false onboardAccessibility:false ``` -------------------------------- ### Download Minecraft Version Source: https://github.com/headlesshq/headlessmc/blob/main/docs/launch.md Manually downloads a specific Minecraft version if it's not already present. The 'versions' command will then list the newly downloaded version. ```bash > download 1.12.2 Downloading 1.12.2... Download successful! > versions id name parent 0 1.12.2 ... ``` -------------------------------- ### Enforce Minimum GameTests Execution Source: https://github.com/headlesshq/headlessmc/blob/main/docs/dev-ci-cd.md Use this JVM argument via the `headlessmc-command` input to ensure a minimum number of GameTests are executed during your CI/CD pipeline runs. ```bash -DMcRuntimeGameTestMinExpectedGameTests=1 ``` -------------------------------- ### Memory Statistics Command Source: https://github.com/headlesshq/headlessmc/blob/main/docs/commands.md Display current memory usage statistics with the memory command. This includes used, free, total, and maximum available memory. ```bash memory ```