Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/lifecycle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
distribution: adopt
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# Could be faster with ./gradlew :headlessmc-launcher-wrapper:shadowJar --stacktrace
- name: Build
run: ./gradlew build --stacktrace
- name: Delete launcher-wrapper dev jar
Expand Down Expand Up @@ -516,13 +517,20 @@ jobs:

docker-build:
runs-on: ubuntu-latest
needs: build-java-8
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: launcher-wrapper-java8-jar
- name: Display structure of downloaded files
run: ls -R
- name: Prepare
run: |
platform=${{ matrix.platform }}
Expand Down Expand Up @@ -550,6 +558,8 @@ jobs:
id: build
uses: docker/build-push-action@v6
with:
context: .
file: ./Fast.Dockerfile
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
Expand Down
26 changes: 26 additions & 0 deletions Fast.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Building HeadlessMc on Linux ARM64 in Github Actions is very slow.
# This Dockerfile assumes that the HeadlessMc launcher has been build.

# the image currently can't run non-headlessly which is ok, but maybe get an image with libX11?
# libX11.so.6: cannot open shared object file: No such file or directory
FROM eclipse-temurin:21-jdk-noble AS build

COPY . /headlessmc
WORKDIR /headlessmc

FROM eclipse-temurin:8-jre-noble AS java8
FROM eclipse-temurin:17-jre-noble AS java17
FROM eclipse-temurin:21-jre-noble

COPY --from=java8 /opt/java/openjdk /opt/java/java8
COPY --from=java17 /opt/java/openjdk /opt/java/java17

COPY --from=build /headlessmc/headlessmc-scripts/version-independent /headlessmc
COPY --from=build /headlessmc/headlessmc-launcher-wrapper.jar /headlessmc

WORKDIR /headlessmc
# add the scripts directory to the path. this allows us to just execute hmc ... comfortably without any ./
ENV PATH="/headlessmc:${PATH}"
RUN chmod +x hmc

ENTRYPOINT ["/bin/bash"]
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
> Offline accounts can only be used to run the game headlessly in CI/CD pipelines.

HeadlessMc (HMC) allows you to launch Minecraft Java Edition from the command line.
It can also modify the game while and before running it.
This feature can be used to make the Minecraft client run in headless mode,
without displaying a UI, controlled by the command line.
HeadlessMc also patches the Log4J vulnerability
and can be used
to test the game in your CI/CD pipeline with [mc-runtime-test](https://github.com/headlesshq/mc-runtime-test).
It can manage clients, servers and mods.
It can run the client in headless mode, without a Screen, controlled by the command line.
This e.g. can allow you to test the game in your CI/CD pipeline with [mc-runtime-test](https://github.com/headlesshq/mc-runtime-test).

## How to use
> [!TIP]
> Read our new, beautiful documentation [here](https://3arthqu4ke.github.io/headlessmc/docs).

## Quickstart

1. Download the `headlessmc-launcher.jar` from the releases tab and install a Java version ≥ 8.
- If you want additional features such as plugins and launching the game inside the same JVM, use the `headlessmc-launcher-wrapper.jar` instead.
Expand All @@ -42,6 +42,8 @@ Login to your Minecraft account by executing the `login` command and follow the
4. Launch the game with `launch <modloader>:<version>`, e.g. `launch fabric:1.21.4 -lwjgl`.
The `lwjgl` flag will make the game run in headless mode.

Read [more](https://3arthqu4ke.github.io/headlessmc/docs/getting-started/).

### HeadlessMc-Specifics

The [hmc-specifics](https://github.com/3arthqu4ke/hmc-specifics) are mods
Expand All @@ -50,6 +52,8 @@ Together with HeadlessMc they allow you to control the game via the command line
by sending chat messages and commands with `msg "<message>"`,
visualizing the menus displayed by Minecraft via `gui` and clicking through menus via `click`.

Read [more](https://3arthqu4ke.github.io/headlessmc/docs/specifics/).

### Docker

A preconfigured [docker image](https://hub.docker.com/r/3arthqu4ke/headlessmc/) exists,
Expand Down Expand Up @@ -149,6 +153,9 @@ You can also achieve headless mode without patching lwjgl by running headlessmc
[Xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml).

### Configuring HeadlessMc
> [!NOTE]
> All configuration options are listed [here](https://3arthqu4ke.github.io/headlessmc/docs/configuration/)

- HeadlessMc stores its configuration in `HeadlessMC/config.properties`.
- On Windows and Linux Java versions in certain folders get detected automatically
and HeadlessMc can download missing Java distributions.
Expand Down
2 changes: 1 addition & 1 deletion docs/specifics.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ We are wearing armor and have some items in our hotbar:
<code style="white-space: pre;">id text x y w h type</code>
<code style="white-space: pre;">0 306 84 18 18 Slot</code>
<code style="white-space: pre;">...</code>
<code style="white-space: pre;">5 <span style="color:white;">[Diamond Helmet]</span> 160 64 18 18 Slot</code>
<code style="white-space: pre;">5 <span style="color:white;">[Diamond Helmet]</span> 160 64 18 18 Slot</code>
<code style="white-space: pre;">6 <span style="color:white;">[Diamond Chestplate]</span> 160 82 18 18 Slot</code>
<code style="white-space: pre;">7 <span style="color:white;">[Diamond Leggings]</span> 160 100 18 18 Slot</code>
<code style="white-space: pre;">8 <span style="color:white;">[Diamond Boots]</span> 160 118 18 18 Slot</code>
Expand Down
2 changes: 2 additions & 0 deletions headlessmc-scripts/version-independent/hmc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env sh
java -jar headlessmc-launcher-wrapper.jar --command $@
2 changes: 2 additions & 0 deletions headlessmc-scripts/version-independent/hmc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
"%JAVA_HOME%\bin\java" -jar headlessmc-launcher-wrapper.jar --command %*
3 changes: 3 additions & 0 deletions headlessmc-scripts/version-independent/hmw
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
# when running in docker on windows bash seems to be at /bin/bash TODO: can we make this one script?
java -jar headlessmc-launcher-wrapper.jar --command $@
Loading