-
Notifications
You must be signed in to change notification settings - Fork 5
Downloading resources
As already mentioned, it is possible to include a list of files that won't be directly included in the MCInstance file, but will instead be downloaded from the internet.
This can be very useful to add external files on platforms with a strict policy like Curseforge
.
It also lets modpack creators bundle way more mods this way, regardless of the license, as linking to a file is often not considered under copyright laws.
To get started, just create a normal packconfig file and rename it resources.packconfig
. Then, as usual, put it on the root of your pack.mcinstance.
This file is separated into multiple objects called resources
. A resource refers to any file you want to download. It can be anything from mods, resourcepacks, maps, config files etc.
Now that we have a blank file to work with, we can add files to download. Currently, there are 3 types of downloads: url
(default), modrinth
and curseforge
. We'll talk about the other two later on.
Let's start with the url
type. Creating a url-based resource is pretty simple:
[My resource] # The resource's name. Chose a unique one per file. Will be displayed to the user and is used for optional files too.
type = url # The resource's type, for URLs, it isn't required as the URL type is the default.
# Where to save the downloaded file. Can be any path from the .minecraft folder.
# Will overwrite existing files in the overrides folder, which will then overwrite the .minecraft files.
# The file extension and file name needs to be included. You can either use \ or / for the file separator.
destination = path/toResource.jar
url = https://www.example.com/MyResource.jar # The URL to download the file from. Can either be a direct link, or something else (see below).
Of course, sometimes, there may not be a direct link for the file but a button or a link to press.
This is why the follows
property can be used instead. Think of it as a list
of buttons to press in a certain order to get to the desired download.
This can be very useful on sites such as Mediafire
or the official Optifine
website, which don't provide a direct file link but have you click on a button instead.
To add the follows
property, just add a list
of strings (see the syntax here). In short, it is a comma-separated
string. If you ever need to include a comma inside a text, write \,
instead.
Here is an example below to download Optifine:
[Optifine]
type = url
destination = mods/Optifine 1.7.10 E7.jar
url = https://optifine.net/adloadx?f=OptiFine_1.7.10_HD_U_E7.jar
# This will click on the big blue download button on the page. (It clicks on the first matching button it finds)
# If i had to click on another button afterwards, i could add a comma and the next button to click.
# The text is stripped so the mod doesn't make a difference between a " Download" button and a "Download" one.
# This only works on HTML elements formated this way: [<blabla href="The hidden url"> Your button text </blabla>]
# (You can check this using your browser's inspect element function)
follows = Download
Now that we seen how to download files from a direct URL, let's look at how to download files from Modrinth.
To do so, just create a resource with the modrinth
type like this:
[My Resource]
type = modrinth
destination = path/toResource.jar
# The versionId of the file you want to download. It can be obtained at the center of the version's download page.
versionId = 000000
# Not always required, but recommended nonetheless.
# This is used to discriminate the file if you want to download from a version with multiple files attached.
# If there is only one file, this isn't required.
# The name of the file, as it is on Modrinth's servers. Not the name you want to give to the file, just the original one.
sourceFileName = TheSuperAmazingMod-1.0.jar
Here is an example with EndlessIDs:
[EndlessIDs]
type = modrinth
destination = mods/EndlessIDs.jar
versionId = j07UnIoo
# As this version has multiple files attached (the normal, dev and sources release), i need to specify it.
sourceFileName = endlessids-mc1.7.10-1.3.0.jar
NOTE: Just like when the mod uses the Curseforge
API, the Modrinth
files are slower than direct downloads.
NOTE 2: The API might change in the future or become unavailable at times. Although, this mod probably won't take much time to update if that's the case.
Finally, let's look at this mod's integration with Curseforge.
Downloading a resource from there is also pretty easy. Just create a resource with the curseforge
type like so:
[My Resource]
type = curseforge
destination = path/toResource.jar
# Not required if the sourceFileName is given, but recommended nonetheless.
# Required to use the API and not only guess the download link (see below).
# The projectId from the project you want to download. Can be obtained on the right side of the project's page.
projectId = 000000
# Required no matter what.
# The fileId of the specific file you want. It can be obtained inside the URL of the file's download page.
fileId = 000000
# Not required if the projectId is given, but recommended nonetheless.
# Required to allow the mod to sometimes directly guess the download link and not just rely on the API.
# The name of the file, as it is on Curseforge's servers. Not the name you want to give to the file, just the original one.
sourceFileName = TheSuperAmazingMod-1.0.jar
Here is an example with the Leviosa resource pack:
[Leviosa]
type = curseforge
destination = resourcepacks/leviosa.zip
# As i added all the properties, the mod is able to both guess the URL and use the API when needed.
projectId = 376145
fileId = 2931151
sourceFileName = Leviosa.zip
NOTE: The mod will try to guess the download URL first if it can. This is possible as curseforge URLs follow a specific pattern.
This is for multiple reasons, this ensures the file can get downloaded (even if opted-out
from the API), this also gives less stress to the API servers and finally, this is faster as the mod doesn't need to parse a JSON
response this way.
NOTE 2: The API is subject to change, and might be unstable at times. This is due to Overwolf
breaking a previously working system. Note that the mod uses by default a proxy, to still allow for opted-out
downloads, it can be changed in the config file of the mod if needed.
Due to them having broken their system, this mod might not always contribute to the mod author's download count anymore.
Optionally, it is possible to mark a certain resource as specific to a certain side
.
Doing so can be useful for example for certain mods that may only work on client
/server
sides and would crash otherwise.
This also means you can easily create an mcinstance
file that will both work for servers and clients.
Doing so is pretty easy, just add the side
property to your resource. It can either be client
, server
or both
(which is the default value, any incorrect value is also considered as both
).
Here is the previous Optifine example made side-specific:
[Optifine]
type = url
destination = mods/Optifine 1.7.10 E7.jar
url = https://optifine.net/adloadx?f=OptiFine_1.7.10_HD_U_E7.jar
follows = Download
# This makes sure the mod won't be downloaded on servers by mistake. (This is a client side mod).
side = client