From 8efb486c566d6927db68477fe88d6404914d8a00 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Thu, 26 Jan 2023 13:46:48 -0600 Subject: [PATCH] For AUTO_CURSEFORGE, can auto-set LEVEL from world save provided by modpack (#1929) --- Dockerfile | 2 +- README.md | 9 +++++++-- examples/one-block-modded/docker-compose.yml | 19 +++++++++++++++++++ scripts/start-deployAutoCF | 7 +++++++ 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 examples/one-block-modded/docker-compose.yml diff --git a/Dockerfile b/Dockerfile index a47475b9..a82c2fea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,7 +46,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ --var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \ --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz -ARG MC_HELPER_VERSION=1.24.13 +ARG MC_HELPER_VERSION=1.24.16 ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION} RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \ | tar -C /usr/share -zxf - \ diff --git a/README.md b/README.md index 0c012f9f..6b674734 100644 --- a/README.md +++ b/README.md @@ -613,7 +613,7 @@ docker run -d --name mc-ftb -e EULA=TRUE \ ### Auto CurseForge Management -To manage a CurseForge modpack automatically with upgrade support, pinned or latest version tracking, set `TYPE` to "AUTO_CURSEFORGE". The appropriate mod loader (Forge / Fabric) version will be automatically installed as declared by the modpack. +To manage a CurseForge modpack automatically with upgrade support, pinned or latest version tracking, set `TYPE` to "AUTO_CURSEFORGE". The appropriate mod loader (Forge / Fabric) version will be automatically installed as declared by the modpack. This mode will also take care of cleaning up unused files installed by previous versions of the modpack, but world data is never auto-removed. > **NOTES:** > Be sure to use the appropriate [image tag for the Java version compatible with the modpack](#running-minecraft-server-on-different-java-version). @@ -653,7 +653,7 @@ The following two examples both refer to version 1.0.7 of ATM8: -e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8 -e CF_FILENAME_MATCHER=1.0.7 ``` -A lot of the time there are mods that need to be excluded, such as ones that did not properly declare as a client mod via the file's game versions. Similarly, there are some mods that are incorrectly tagged as client only. The following describes two options to exclude/include mods: +Quite often there are mods that need to be excluded, such as ones that did not properly declare as a client mod via the file's game versions. Similarly, there are some mods that are incorrectly tagged as client only. The following describes two options to exclude/include mods: Global and per modpack exclusions can be declared in a JSON file and referenced with `CF_EXCLUDE_INCLUDE_FILE`. By default, [the file bundled with the image](files/cf-exclude-include.json) will be used. The schema of this file [is documented here](https://github.com/itzg/mc-image-helper#excludeinclude-file-schema). @@ -666,8 +666,13 @@ If needing to iterate on the options above, set `CF_FORCE_SYNCHRONIZE` to "true" > **NOTE:** these options are provided to empower you get your server up and running quickly. Please help out by reporting an issue with the respective mod project. Ideally mod developers should [use correct registrations for one-sided client mods](https://docs.minecraftforge.net/en/latest/concepts/sides/#writing-one-sided-mods). Understandably, those code changes may be non-trivial, so mod authors can also add "Client" to the game versions when publishing. +Some modpacks come with world/save data via a worlds file and/or the overrides provided with the modpack. Either approach can be selected to set the `LEVEL` to the resulting saves directory by setting `CF_SET_LEVEL_FROM` to either: +- `WORLD_FILE` +- `OVERRIDES` + Other configuration available: - `CF_PARALLEL_DOWNLOADS` (default is 4): specify how many parallel mod downloads to perform +- `CF_OVERRIDES_SKIP_EXISTING` (default is false): if set, files in the overrides that already exist in the data directory are skipped. **NOTE** world data is always skipped, if present. ### Old approach diff --git a/examples/one-block-modded/docker-compose.yml b/examples/one-block-modded/docker-compose.yml new file mode 100644 index 00000000..6abc226a --- /dev/null +++ b/examples/one-block-modded/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3.8" + +services: + mc: + image: itzg/minecraft-server + ports: + - "25565:25565" + environment: + EULA: "true" + TYPE: AUTO_CURSEFORGE + CF_PAGE_URL: "https://www.curseforge.com/minecraft/modpacks/one-block-modded/files/4136487" + CF_SET_LEVEL_FROM: OVERRIDES + DEBUG: "false" + MEMORY: 4G + volumes: + - mc-data:/data + +volumes: + mc-data: {} \ No newline at end of file diff --git a/scripts/start-deployAutoCF b/scripts/start-deployAutoCF index 58c321b7..57c3f88f 100644 --- a/scripts/start-deployAutoCF +++ b/scripts/start-deployAutoCF @@ -13,6 +13,9 @@ set -eu : "${CF_EXCLUDE_INCLUDE_FILE:=https://raw.githubusercontent.com/itzg/docker-minecraft-server/master/files/cf-exclude-include.json}" : "${CF_EXCLUDE_MODS:=}" : "${CF_FORCE_INCLUDE_MODS:=}" +: "${CF_SET_LEVEL_FROM:=}" # --set-level-from +: "${CF_OVERRIDES_SKIP_EXISTING:=false}" # --overrides-skip-existing + resultsFile=/data/.install-curseforge.env @@ -33,9 +36,13 @@ fi if [[ $CF_FILENAME_MATCHER ]]; then args+=(--filename-matcher="$CF_FILENAME_MATCHER") fi +if [[ ${CF_SET_LEVEL_FROM} ]]; then + args+=(--set-level-from="$CF_SET_LEVEL_FROM") +fi args+=( --parallel-downloads="$CF_PARALLEL_DOWNLOADS" --force-synchronize="$CF_FORCE_SYNCHRONIZE" + --overrides-skip-existing="$CF_OVERRIDES_SKIP_EXISTING" ) if [[ $CF_EXCLUDE_MODS || $CF_FORCE_INCLUDE_MODS ]]; then