Treasure Bags Mod Wiki › Guides › Creating Bag Types in Treasure Bags
Creating Bag Types in Treasure Bags
To add bags to your game, you must create a data pack. Bag types are defined in the following directory: data/<namespace>/treasure_bags/bag_types/<name>.json.
JSON Structure
A bag type file requires several key fields to define its appearance and behavior:
| Field | Type | Description |
|---|---|---|
name |
String/Object | The display name of the bag. Supports raw strings or JSON text components (for translations/colors). |
bagColor |
Hex String | The primary color of the bag texture (e.g., "0xFFFFFF"). |
bagStringColor |
Hex String | The color of the string tied around the bag (e.g., "0x000000"). |
lootTable |
Resource Location | The ID of the loot table to roll when the bag is opened. |
rarity |
String | The rarity color of the item name (common, uncommon, rare, epic). |
Example Bag Type JSON:
{
"name": "Dungeon Treasure",
"bagColor": "0x4A4A4A",
"bagStringColor": "0xFFD700",
"lootTable": "minecraft:chests/simple_dungeon",
"rarity": "rare"
}