Wiki 9Minecraft Wiki 9Minecraft

Creating Bag Types in Treasure Bags

Java EditionModGuides 5FAQ 10Related mods 48
DownloadTreasure Bags Mod

Get the files on 9Minecraft

Contents (3)
  1. JSON Structure
  2. Next guides
  3. More in this wiki

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"
}