Skip to content

Commit

Permalink
Added support for NeoForge (#2408)
Browse files Browse the repository at this point in the history
  • Loading branch information
itzg authored Oct 3, 2023
1 parent d5e315b commit fa235e9
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=1.9.0 --var app=mc-server-runner --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz

ARG MC_HELPER_VERSION=1.35.3
ARG MC_HELPER_VERSION=1.36.0
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
# used for cache busting local copy of mc-image-helper
ARG MC_HELPER_REV=1
Expand Down
20 changes: 20 additions & 0 deletions docs/types-and-platforms/server-types/forge.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,23 @@ In both of the cases above, there is no need for the `VERSION` or `FORGE_VERSION
!!! note

If an error occurred while installing Forge, it might be possible to resolve by temporarily setting `FORGE_FORCE_REINSTALL` to "true". Be sure to remove that variable after successfully starting the server.

## Alternatives

### NeoForge

Support for [NeoForge](https://neoforged.net/) is also provided. A NeoForge server can be automatically managed by setting `TYPE` to "NEOFORGE". `VERSION` specifies the Minecraft version and `NEOFORGE_VERSION` can be set to select a specific sub-version. By default, the latest NeoForge version available for the requested Minecraft version will be used.

!!! example

```
docker run -e TYPE=NEOFORGE -e VERSION=1.20.1 -e NEOFORGE_VERSION=47.1.79 ...
```

or in a compose file
```yaml
environment:
TYPE: NEOFORGE
VERSION: "1.20.1"
NEOFORGE_VERSION: "47.1.79"
```
4 changes: 4 additions & 0 deletions scripts/start-configuration
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ case "${TYPE^^}" in
exec "${SCRIPTS:-/}start-deployForge" "$@"
;;

NEOFORGE|NEOFORGED)
exec "${SCRIPTS:-/}start-deployNeoForge" "$@"
;;

FABRIC)
exec "${SCRIPTS:-/}start-deployFabric" "$@"
;;
Expand Down
30 changes: 30 additions & 0 deletions scripts/start-deployNeoForge
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

: "${NEOFORGE_VERSION:=latest}"
: "${NEOFORGE_FORCE_REINSTALL:=false}}"

# shellcheck source=start-utils
. "${SCRIPTS:-$(dirname "$0")}/start-utils"
isDebugging && set -x

resultsFile=/data/.run-neoforge.env

if ! mc-image-helper install-neoforge \
--output-directory=/data \
--results-file=${resultsFile} \
--minecraft-version="${VERSION}" \
--neoforge-version="${NEOFORGE_VERSION}" \
--force-reinstall="${NEOFORGE_FORCE_REINSTALL}"; then
log "ERROR failed to install Forge"
exit 1
fi

# grab SERVER and export it
set -a
# shellcheck disable=SC1090
source ${resultsFile}
set +a

export FAMILY=FORGE

exec "${SCRIPTS:-/}start-setupWorld" "$@"

0 comments on commit fa235e9

Please sign in to comment.