Custom Backpacks
Creating Backpacks is done through data-packs. We will have to create the recipe where we also define our backpacks traits, gift the player the recipe so it appears in the crafting book, make backpacks translatable, and finally texture them.
If you need help creating a data pack, read through the minecraft wiki's Tutorials/Creating a data pack or follow along with Copper Backpack Data. A Copper Backpack for crafting and a Netherite Backpack for smithing is what we will re-create though this tutorial.
If you are creating a backpack for a mod you should use that mod's file path for the data & resource packs. For example if I was adding mods for the aether, I would create my data pack folders with the path
data/aether/recipes
and resource pack folders with the pathassets/aether/textures
. Also I would change references to other files (not crafting types or backpack items) would look likeaether:backpacks/copper_backpack
. If you are unsure about this you may usebeansbackpacks
Backpack recipe's are similar to vanilla with a few key differences. Create a .json file with the path data/beansbackpacks/recipes/backpacks
. This can be named with characters a-z
, 0-9
, _
, all lowercase, no spaces, and should be recognizable since we need it later. The mod will only register new backpacks inside the recipes/backpacks
folder, so if there are multiple recipes placing the extra recipes outside of backpacks
but still in recipes
will not register new traits for the backpack_id
.
Firstly, the recipe type
can be either beansbackpacks:crafting
or beansbackpacks:smithing
to determine whether this backpack is created in the crafting or smithing table. a vanilla minecraft type
cannot be used since we cannot add nbt data to our result normally. The recipe's pattern is written the same as vanilla, you can use TheDestruc7i0n's Crafting Generator to create the vanilla crafting/smithing recipe and copy pattern
& key
for crafting or template
, base
, & addition
for smithing.
Note for smithing, the NBT of the
base
gets copied to the new backpack.
crafting (Copper Backpack) | smithing (Netherite Backpack) |
---|---|
"type": "beansbackpacks:crafting",
"pattern": [
"iBi",
"i i",
"iBi"
],
"key": {
"i": {
"item": "minecraft:copper_ingot"
},
"P": {
"item": "minecraft:phantom_membrane"
}
} |
"template": {
"item": "minecraft:netherite_upgrade_smithing_template"
},
"base": {
"item": "beansbackpacks:metal_backpack"
},
"addition": {
"item": "minecraft:netherite_ingot"
} |
This is where we deviate from the vanilla recipes. Define the backpack_id
. This is the identifier used to collect a backpack's traits and textures. The backpack_id
should be a-z
, 0-9
, _
, all lowercase, no spaces. It should also be unique, yet defines the backpack in question. For example, the backpack id copper
describes the material it's crafted with and if copper is used in another pack, your recipe will still create a copper backpack.
"backpack_id": "copper"
Then we'll describe the backpack's traits. So far there are 4 traits you can specify, if you do not include a value it will assume the Traits of an Iron Backpack (Default Value).
Trait | Definition | Default Value |
---|---|---|
max_stacks |
Maximum number of stacks this backpack can hold | 7 |
fire_resistant |
Item will not burn and will float in lava | false |
fallback_name |
The name used if no translation is provided | "Iron Backpack" |
button_material |
gold , amethyst , diamond , netherite , or none
|
"diamond" |
That's it! your data and recipe is completed and your backpack in now in the game (in a completely un usable state). Below is what your recipe's could look like once you're done. Keep reading to finish adding your backpack.
crafting (Copper Backpack) | smithing (Netherite Backpack) |
---|---|
{
"type": "beansbackpacks:crafting",
"backpack_id": "copper",
"pattern": [
"iBi",
"i i",
"iBi"
],
"key": {
"i": {
"item": "minecraft:copper_ingot"
},
"B": {
"item": "minecraft:phantom_membrane"
}
},
"traits": {
"fallback_name": "Copper Backpack"
}
} |
{
"type": "beansbackpacks:smithing",
"backpack_id": "netherite",
"template": {
"item": "minecraft:netherite_upgrade_smithing_template"
},
"base": {
"item": "beansbackpacks:metal_backpack"
},
"addition": {
"item": "minecraft:netherite_ingot"
},
"traits": {
"max_stacks": 11,
"fire_resistant": true,
"fallback_name": "Netherite Backpack",
"button_material": "netherite"
} |
If your backpack has multiple recipes, place any additional outside of recipes/backpacks
and inside of recipes
to avoid registering a backpack's traits twice. If the recipe is outside of backpacks
then traits from that file will not be registered and aren't needed to be written twice. Click this block of text for an example of a second Copper Backpack recipe.
{
"type": "beansbackpacks:crafting",
"backpack_id": "copper",
"pattern": [
"B",
"i",
"B"
],
"key": {
"B": {
"item": "minecraft:phantom_membrane"
},
"i": {
"item": "minecraft:copper_block"
}
}
}
Recipe's do not appear in the vanilla Crafting Book by default, they must be rewarded to the player through advancements. These advancements do not appear in any menus and do not have any notifications through sounds or popups. Use misode's Advancement Generator. The preset recipes/combat/iron_chestplate
is a good place to start. That gives the player the recipe for an Iron Chestplate once a player picks up an Iron Ingot or Crafts an Iron Chestplate. It specifies the Iron Chestplate recipe with "rewards": {"recipes": ["minecraft:iron_chestplate"] }
. We can specify our own by replacing minecraft:iron_chestplate
with beansbackpacks:backpacks/
followed by the the name of the file we called our recipe.
Click to see the Copper Backpack recipe be rewarded by collecting a copper ingot, phantom membrane, any metal backpack, or by crafting the Copper Backpack.
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_backpack": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"beansbackpacks:metal_backpack"
]
}
]
}
},
"has_gold": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"minecraft:copper_ingot"
]
}
]
}
},
"has_membrane": {
"trigger": "minecraft:inventory_changed",
"conditions": {
"items": [
{
"items": [
"minecraft:phantom_membrane"
]
}
]
}
},
"has_the_recipe": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "beansbackpacks:backpacks/copper_backpack"
}
}
},
"requirements": [
[
"has_backpack",
"has_the_recipe",
"has_gold",
"has_membrane"
]
],
"rewards": {
"recipes": [
"beansbackpacks:backpacks/copper_backpack"
]
},
"sends_telemetry_event": false
}
The data-pack is now finished. To texture your backpack you will need to create a resource pack including the: item's model, item's texture, the entity's texture, and later the translation for the backpack. Let's setup your file structure so you have somewhere to put all this.
assets
└── beansbackpacks
├── lang
│ └── en_us.json
├── models
│ └── item
│ └── backpack
│ └── copper.json
└── textures
├── entity
│ └── backpack
│ └── copper.png
└── item
└── copper_backpack.png
This is the file structure for a Copper Backpack. As you can see, under models/item/backpack
& textures/entity/backpack
the file names are the backpack_id
we defined earlier. We'll get back to the other two files.
-
Item Model
-
The Item Model is written just like vanilla. It must be named the same as it's
backpack_id
and must be placed undermodels/item/backpack/
or the mod will not be able to find the model. Here is an example of the code inside copper.json{ "parent": "minecraft:item/generated", "textures": { "layer0": "beansbackpacks:item/copper_backpack" } }
Item Texture
-
According to
copper.json
, this file should be namedcopper_backpack.png
. If you're familiar with resource packs there's nothing special here.
You can use this template item texture as somewhere to start.
Entity Texture
-
Must be named the
backpack_id
of your backpack and placed intextures/entity/backpack/
You can use this template entity texture as somewhere to start.
The fallback_name
provided above is incase there is no translation provided. In the case that you want to add your own, in the lang file of the given language create the translation tooltip.beansbackpacks.name.
+ the backpack_id
of the backpack. For example, If I would want to add a translation for a copper backpack in United States English (en_us.json
) I would write...
{
"tooltip.beansbackpacks.name.copper": "Copper Backpack"
}
To find your country's translation, look it up on the Minecraft's Wiki Language page.
If you have any further questions or need clarification, don't be afraid to leave an issue. This is an early draft of the wiki, written by someone who knows this mod inside and out. Some information might not be written clearly enough or might be lacking entirely and I want your help.