Skip to content

Commit c26119b

Browse files
authored
Allow custom modloader versions for auto curseforge (#3759)
1 parent 85673fb commit c26119b

File tree

5 files changed

+82
-28
lines changed

5 files changed

+82
-28
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
4949
--var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \
5050
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
5151

52-
ARG MC_HELPER_VERSION=1.50.6
52+
ARG MC_HELPER_VERSION=1.50.8
5353
ARG MC_HELPER_BASE_URL=${GITHUB_BASEURL}/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
5454
# used for cache busting local copy of mc-image-helper
5555
ARG MC_HELPER_REV=1

docs/types-and-platforms/mod-platforms/auto-curseforge.md

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,33 @@ To manage a CurseForge modpack automatically with upgrade support, pinned or lat
77
!!! warning "CurseForge API key usage"
88

99
A CurseForge API key is **required** to use this feature. Go to their [developer console](https://console.curseforge.com/), generate an API key, and set the environment variable `CF_API_KEY`.
10-
10+
1111
When entering your API Key in a docker compose file you will need to escape any `$` character with a second `$`. Refer to [this compose file reference section](https://docs.docker.com/compose/compose-file/compose-file-v3/#variable-substitution) for more information.
12-
12+
1313
Example if your key is `$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa`:
1414
```yaml title="compose.yaml"
1515
environment:
1616
CF_API_KEY: '$$11$$22$$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
1717
```
1818
If you use `docker run` you will need to make sure to use single quotes:
19-
19+
2020
```shell
2121
docker run ... -e CF_API_KEY='$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
2222
```
23-
24-
To avoid exposing the API key, it is highly recommended to use a `.env` file, which is [loaded automatically by docker compose](https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-with-an-env-file). You **do not** need to escape `$`'s with a second `$` in the `.env` file **as long as the key is wrapped in single quotes**.
25-
23+
24+
To avoid exposing the API key, it is highly recommended to use a `.env` file, which is [loaded automatically by docker compose](https://docs.docker.com/compose/environment-variables/set-environment-variables/#substitute-with-an-env-file). You **do not** need to escape `$`'s with a second `$` in the `.env` file **as long as the key is wrapped in single quotes**.
25+
2626
```title=".env"
2727
CF_API_KEY='$11$22$33aaaaaaaaaaaaaaaaaaaaaaaaaa'
2828
```
29-
29+
3030
The variable should to be referenced from the compose file, such as:
31-
31+
3232
```yaml title="compose.yaml"
3333
environment:
3434
CF_API_KEY: ${CF_API_KEY}
3535
```
36-
36+
3737
The .env file should be placed in the same directory as your compose file like so:
3838

3939
```
@@ -42,20 +42,20 @@ To manage a CurseForge modpack automatically with upgrade support, pinned or lat
4242
├── compose.yaml
4343
├── data/
4444
```
45-
45+
4646
To use the equivalent with `docker run` you need to specify the `.env` file explicitly:
4747
```shell
4848
docker run --env-file=.env itzg/minecraft-server
4949
```
50-
50+
5151
Alternately you can use [docker secrets](https://docs.docker.com/compose/how-tos/use-secrets/) with a `CF_API_KEY_FILE` environment variable:
5252
```yaml title="compose.yaml"
5353
service:
5454
environment:
5555
CF_API_KEY_FILE: /run/secrets/cf_api_key
5656
secrets:
5757
- cf_api_key
58-
58+
5959
secrets:
6060
cf_api_key:
6161
file: cf_api_key.secret
@@ -64,14 +64,14 @@ To manage a CurseForge modpack automatically with upgrade support, pinned or lat
6464

6565
!!! note
6666
Be sure to use the appropriate [image tag for the Java version compatible with the modpack](../../versions/java.md).
67-
67+
6868
Most modpacks require a good amount of memory, so it best to set `MEMORY` to at least "4G" since the default is only 1 GB.
6969

7070
## Usage
7171

7272
Use one of the following to specify the modpack to install:
7373

74-
Pass a page URL to the modpack or a specific file with `CF_PAGE_URL` such as the modpack page "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8" or a specific file "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8/files/4248390".
74+
Pass a page URL to the modpack or a specific file with `CF_PAGE_URL` such as the modpack page "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8" or a specific file "https://www.curseforge.com/minecraft/modpacks/all-the-mods-8/files/4248390".
7575

7676
!!! example "Using CF_PAGE_URL"
7777

@@ -83,7 +83,7 @@ Pass a page URL to the modpack or a specific file with `CF_PAGE_URL` such as the
8383
CF_API_KEY: ${CF_API_KEY}
8484
CF_PAGE_URL: https://www.curseforge.com/minecraft/modpacks/all-the-mods-8
8585
```
86-
86+
8787
```title="Using docker run"
8888
docker run -e CF_API_KEY=${CF_API_KEY} -e TYPE=AUTO_CURSEFORGE -e CF_PAGE_URL=https://www.curseforge.com/minecraft/modpacks/all-the-mods-8
8989
```
@@ -102,7 +102,7 @@ Instead of a URL, the modpack slug can be provided as `CF_SLUG`. The slug is the
102102
CF_API_KEY: ${CF_API_KEY}
103103
CF_SLUG: all-the-mods-8
104104
```
105-
105+
106106
```title="Using docker run"
107107
docker run -e CF_API_KEY=${CF_API_KEY} -e TYPE=AUTO_CURSEFORGE -e CF_SLUG=all-the-mods-8
108108
```
@@ -137,6 +137,30 @@ The following examples all refer to version 1.0.7 of ATM8:
137137
138138
Pinning modpack version also pins the mod loader (to the version specified by the modpack). Mod loader version cannot be pinned independently of the modpack.
139139
140+
### Custom modloader versions
141+
142+
By default, AUTO_CURSEFORGE will use the exact modloader version declared by the modpack. However, you can override the modloader version by setting the following environment variable:
143+
144+
- `CF_MOD_LOADER_VERSION`: Override the mod loader version (e.g., `43.4.22`)
145+
146+
!!! example "Override mod loader version"
147+
148+
```yaml
149+
environment:
150+
MODPACK_PLATFORM: AUTO_CURSEFORGE
151+
CF_API_KEY: ${CF_API_KEY}
152+
CF_SLUG: all-the-mods-8
153+
CF_MOD_LOADER_VERSION: "43.4.22"
154+
```
155+
156+
```title="Using docker run"
157+
docker run -e CF_MOD_LOADER_VERSION=43.4.22 -e CF_SLUG=my-fabric-pack ...
158+
```
159+
160+
!!! warning "Compatibility"
161+
162+
Using a custom modloader version that differs significantly from what the modpack was designed for may cause compatibility issues. Use this feature carefully and test thoroughly.
163+
140164
## Manual Downloads
141165

142166
For mod, modpacks, and world files that are not allowed for automated download, the container path `/downloads` can be attached and matching files will be retrieved from there. The subdirectories `mods`, `modpacks`, and `worlds` will also be checked accordingly. To change the source location of downloaded files, set `CF_DOWNLOADS_REPO` to an existing container path. To disable this feature, set `CF_DOWNLOADS_REPO` to an empty string.
@@ -148,12 +172,12 @@ For mod, modpacks, and world files that are not allowed for automated download,
148172
!!! example
149173

150174
Assuming Docker compose is being used:
151-
175+
152176
1. Create a directory next to the `compose.yaml` file. The name doesn't matter, but "downloads" is the common convention
153177
2. From the "Mods Need Download" output, visit the download page of each, click on the file download and save that file into the directory created in the previous step
154178
3. Add a host directory mount to the volumes section where the container path **must be** `/downloads`. The snippet below shows how that will look
155179
4. Re-run `docker compose up -d` to apply the changes
156-
180+
157181
```yaml
158182
volumes:
159183
./downloads:/downloads
@@ -182,7 +206,7 @@ If you wish to use an unpublished modpack zip, set the container path to the fil
182206
```
183207

184208
where an exported manifest file should look like:
185-
209+
186210
```json
187211
{
188212
"minecraft": {
@@ -222,7 +246,7 @@ Mods can be excluded by passing a comma or space delimited list of **project** s
222246

223247
!!! note
224248
`CF_FORCE_INCLUDE_MODS` will not download additional mods.
225-
249+
226250
For additional mods, refer to [the `CURSEFORGE_FILES` variable](../../mods-and-plugins/curseforge-files.md).
227251

228252
A mod's project ID can be obtained from the right hand side of the project page:
@@ -238,7 +262,7 @@ If needing to iterate on the options above, set `CF_FORCE_SYNCHRONIZE` to "true"
238262
!!! tip "Embedded comments"
239263

240264
Comments can be embedded in the list using the `#` character.
241-
265+
242266
```yaml
243267
CF_EXCLUDE_MODS: |
244268
# Exclude client-side mods not published correctly
@@ -248,7 +272,7 @@ If needing to iterate on the options above, set `CF_FORCE_SYNCHRONIZE` to "true"
248272

249273
## Excluding Overrides Files
250274

251-
Modpack zip files typically include an `overrides` subdirectory that may contain config files, world data, and extra mod files. All of those files will be extracted into the `/data` path of the container. If any of those files, such as incompatible mods, need to be excluded from extraction, then the `CF_OVERRIDES_EXCLUSIONS` variable can be set with a comma or newline delimited list of ant-style paths ([see below](#ant-style-paths)) to exclude, relative to the overrides (or `/data`) directory.
275+
Modpack zip files typically include an `overrides` subdirectory that may contain config files, world data, and extra mod files. All of those files will be extracted into the `/data` path of the container. If any of those files, such as incompatible mods, need to be excluded from extraction, then the `CF_OVERRIDES_EXCLUSIONS` variable can be set with a comma or newline delimited list of ant-style paths ([see below](#ant-style-paths)) to exclude, relative to the overrides (or `/data`) directory.
252276

253277
### Ant-style paths
254278

@@ -261,15 +285,15 @@ Ant-style paths can include the following globbing/wildcard symbols:
261285
| `?` | Matches one character |
262286

263287
!!! example
264-
288+
265289
The following compose `environment` entries show how to exclude Iris and Sodium mods from the overrides
266-
290+
267291
```yaml
268292
CF_OVERRIDES_EXCLUSIONS: mods/iris*.jar,mods/sodium*.jar
269293
```
270-
294+
271295
or using newline delimiter, which improves maintainability
272-
296+
273297
```yaml
274298
CF_OVERRIDES_EXCLUSIONS: |
275299
mods/iris*.jar

docs/variables.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
747747
<td>A path to a file inside of container that contains <strong>YOUR</strong> CurseForge (Eternal) API Key.</td>
748748
<td><code></code></td>
749749
<td>✅</td>
750-
</tr>
750+
</tr>
751751
<tr>
752752
<td><code>CF_PAGE_URL</code></td>
753753
<td>Pass a page URL to the modpack or a specific file</td>
@@ -818,6 +818,12 @@ alternatively, you can mount: <code>/etc/localtime:/etc/localtime:ro
818818
<td><code>false</code></td>
819819
<td>⬜️</td>
820820
</tr>
821+
<tr>
822+
<td><code>CF_MOD_LOADER_VERSION</code></td>
823+
<td>Override the mod loader version declared by the modpack</td>
824+
<td><code></code></td>
825+
<td>⬜️</td>
826+
</tr>
821827
</tbody>
822828
</table>
823829

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
services:
2+
mc:
3+
image: itzg/minecraft-server
4+
environment:
5+
EULA: "TRUE"
6+
MODPACK_PLATFORM: AUTO_CURSEFORGE
7+
# Allocate API key from https://console.curseforge.com/
8+
CF_API_KEY: ${CF_API_KEY}
9+
# Example of overriding modloader version for a Fabric modpack
10+
# Refer to https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#api-key
11+
CF_SLUG: "cobblemon-fabric"
12+
# Override the mod loader version from the modpack
13+
CF_MOD_LOADER_VERSION: "0.16.14"
14+
MEMORY: "4G"
15+
ports:
16+
- "25565:25565"
17+
volumes:
18+
- ./data:/data
19+
stdin_open: true
20+
tty: true
21+
22+
# See https://docker-minecraft-server.readthedocs.io/en/latest/types-and-platforms/mod-platforms/auto-curseforge/#custom-modloader-versions

scripts/start-deployAutoCF

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ set -eu
2222
: "${CF_MODPACK_MANIFEST:=}"
2323
: "${CF_API_CACHE_DEFAULT_TTL:=}" # as ISO-8601 duration, such as P2D or PT12H
2424
: "${CF_API_KEY_FILE:=}" # Path to file containing CurseForge API key
25+
: "${CF_MOD_LOADER_VERSION:=}" # Override mod loader version
2526

2627
resultsFile=/data/.install-curseforge.env
2728

@@ -66,6 +67,7 @@ setArg --exclude-mods CF_EXCLUDE_MODS
6667
setArg --force-include-mods CF_FORCE_INCLUDE_MODS
6768
setArg --exclude-include-file CF_EXCLUDE_INCLUDE_FILE
6869
setArg --downloads-repo CF_DOWNLOADS_REPO
70+
setArg --mod-loader-version CF_MOD_LOADER_VERSION
6971

7072
if ! mc-image-helper install-curseforge "${args[@]}"; then
7173
logError "Failed to auto-install CurseForge modpack"

0 commit comments

Comments
 (0)