Getting Started
Addons can be created by using Backpacked's addon format or writing an addon mod.
Ensure you have read the Introduction before proceeding. Requirements and many basic concepts will not be explained in this guide.
Formats
➕ Addon Pack
This is the recommended format for developing a Backpacked addon. A mod should only be used if you plan to add extra features via code or you want to integrate into an existing mod.
Backpacked introduces a special pack format for addons, which merges a resource and data pack into a single ZIP file, instead of two seperate files. This means Backpacked addons can uploaded as a resource pack on CurseForge and Modrinth; players will be able to easily install with one click, and safely include and share in a modpack.
Steps
-
To begin creating an addon pack, you'll want to download the 📦 Base Addon Pack. This is a ZIP file, just like a resource pack. It comes with all the assets and data folder structures created and the more important
backpacked_addon.mcmeta
file. -
Set up an environment to test the addon. In the Minecraft launcher of your choice, you'll want to create a launch configuration with Backpacked
3.0+
installed, preferably with a unique game directory. You can use either NeoForge or Fabric, it will not affect the addon. -
In the
resourcepacks
folder of the configuration's game directory, create a folder with the name of your addon. Next, extract the contents of the Base Addon Pack into that new folder. -
In the extracted contents, in both the
assets
anddata
folder, rename the namespace folderexample
to a new unique namespace. It may only contain lowercase letters froma-z
and_
. If the name of the addon isMy Awesome Backpacks
, the namespace should be set asmy_awesome_backpacks
. -
In the extracted contents, locate and open the file
backpacked_addon.mcmeta
in a text editor.- Update the
name
,description
, andauthor
fields. - For
addon_format
, you will need to update this based on the version of Backpacked you are using. You can find which format version you need to use here. assets_format
anddata_format
is the same field you see inpack.mcmeta
of resource and data packs, and the format version is generally tied to the version of Minecraft. Update these fields according to the version of Minecraft that the addon is targetting. A full list of the format versions can be found on the Minecraft Wiki.
backpacked_addon.mcmeta{
"backpacked_addon": {
"name": "Example Backpacked Addon",
"description": "Adds in many cool new backpacks",
"author": "MrCrayfish",
"addon_format": 1, // 1 is for Backpacked 3.0+
"assets_format": 34, // 34 is for MC 1.21.1
"data_format": 48 // 48 is for MC 1.21.1
}
} - Update the
-
Verify the addon is working. Start up the game, in the Resource Packs menu, the addon should be visible under the Selected list. Open a world, and run the command
/datapack list
and in the list of loaded datapacks, it should show[file/<your_addon_name>]
.
📦 Addon Mod
Backpacked addons can also be developed and packaged as a mod. Depending on if the addon will be a dedicated addon or it will be integrated into an existing mod, this may affect the next steps.
A. Integrating Into an Existing Mod
Since backpacks are created only through assets and data, naturally they are a soft dependency when implemented into a mod as there is no code. This means an existing mod could safely add new backpacks, and it will not crash if Backpacked is not installed. This is great because there could be a mod that adds in furniture, but if Backpacked is installed alongside it, special furniture styled backpacks could be made available to unlock.
Steps
- NeoForge and Fabric in Minecraft 1.21.1+ support the ability to load mods that are placed in the
mods
folder of your launch configurations. So simply download Backpacked (and its dependency Framework) and place it into themods
folder. - Verify that Backpacked is working by launching the game. If loaded using NeoForge, go to the mods page, and Backpacked should be present in the list. If loaded using Fabric, check the logs and Backpacked should be listed as a loaded mod. If everything looks good, you can move on to Registering a Backpack.
B. As a Dedicated Addon Mod
If the mod will be enitrely about adding new backpacks and uses no code (which is possible in this case), a regular Addon Pack is recommended instead of a mod.
As a dedicated mod, addons will have not only have the ability to add more backpacks, but can even add in new types of unlock challenges, rendering functions, value sources, or even completely overriding rendering with a custom implementation.
Implementing Backpacked
A GitHub username and personal token will need to be added to the Gradle environment in order to access the required dependencies for building. These should be added as properties into the gradle.properties
file located in the GRADLE_USER_HOME
directory. On Windows, you can quickly navigate to the required directory by pasting %GRADLE_USER_HOME%
into a File Explorer window. Personal tokens can be generated on the token settings page once logged into a GitHub account.
For security purposes, it is recommended to generate a new personal token with only the read:packages
scope enabled. This will limit the token to only reading packages. It will not have the permissions to do anything else on the account. An expiry is also recommended to prevent the token from working forever.
- Append the GitHub username and personal token into the bottom of
gradle.properties
.
...
gpr.user=<USERNAME>
gpr.key=<GITHUB_PERSONAL_TOKEN>
- Add the maven repository and dependencies to your
build.gradle
.
repositories {
maven {
name = "MrCrayfish (GitHub)"
url = "https://maven.pkg.github.com/MrCrayfish/Maven"
credentials {
username = findProperty("gpr.user")
password = findProperty("gpr.key")
}
}
}
dependencies {
// For common module
implementation "com.mrcrayfish:backpacked-common:<minecraft_version>-<backpacked_version>"
// NeoForge
implementation "com.mrcrayfish:backpacked-neoforge:<minecraft_version>-<backpacked_version>"
// Fabric
modImplementation "com.mrcrayfish:backpacked-fabric:<minecraft_version>-<backpacked_version>"
}
- Verify that Backpacked is working by launching the game. If loaded using NeoForge, go to the mods page, and Backpacked should be present in the list. If loaded using Fabric, check the logs and Backpacked should be listed as a loaded mod.
Next Step
If everything looks good, it's time to move on to Registering a Backpack.