Tag

Jump to navigation Jump to search
This article is about data pack and behavior pack tags. For other uses, see Tag (disambiguation).

Tags (also called registry tags) in data packs[JE only] and behavior packs[BE only] allow players to group different game elements together.

Usage[edit | edit source]

Java Edition[edit | edit source]

Tags are part of the data pack directory structure, highlighted below:

Minecraft defines many tags in the vanilla data pack in the minecraft namespace. These tags are often referenced by the code or other vanilla data pack files. Modifying those tags through a data pack therefore has a direct effect. For example, vanilla block tags are used for various block behaviors, vanilla item tags are used for various item behaviors, vanilla advancement files and vanilla recipe files, and vanilla entity type tags are used for various mob behaviors. See § List of tag types section for their usages.

Resource location[edit | edit source]

The resource location of a tag is also in the format of <namespace>:<path>, where namespace is the name of the folder that the tags folder is in, and path is the JSON file's path under the respective tag folder.

For example, JSON file 'data/wiki/tags/block/foo/example.json' defines a block tag with the resource location of wiki:foo/example.

To distinguish normal contents from tags, a “#” is usually required before tag's resource location.

JSON format[edit | edit source]

  • [NBT Compound / JSON Object] The root object.
    • [Boolean] replace: Optional. Whether or not the contents of this tag should completely replace tag contents from different lower priority data packs with the same resource location. When false the tag's content is appended to the contents of the higher priority data packs, instead. Defaults to false.
    • [NBT List / JSON Array] values: A list of mix and match of object names and tag names. For tags, recursive reference is possible, but a circular reference causes a loading failure.
      • [String]: An object's resource location.
      • [String]: ID of another tag of the same type, prefixed with a #.
      • [NBT Compound / JSON Object]: An entry with additional options.
        • [String] id: A string in one of the string formats above.
        • [Boolean] required: Whether or not loading this tag should fail if this entry is not found, true by default (also for the string entries). A tag that fails to load can still be referenced in any data pack and be (re)defined in other data packs. In other words, only the entries in this JSON file are ignored if this entry cannot be found.

Bedrock Edition[edit | edit source]

Tags are defined in the block's, item's, and biome's behavior as follows:

JSON format[edit | edit source]

  • [NBT Compound / JSON Object] The root object.
    • [NBT Compound / JSON Object] minecraft:<definition>: The type of definition. Must be a block, item, or biome.
      • [NBT Compound / JSON Object] components
        • [NBT Compound / JSON Object] minecraft:tags (Biomes and items only)
          • [NBT List / JSON Array] tags: List of tags.
            • [String]: A tag name.
        • [NBT Compound / JSON Object] tag:<tag name>: (Blocks only) <tag name> is replaced by the name of the tag. Object must be empty.

A block, item, or biome may have multiple tags. Custom and vanilla tags are authorized.

Tags can be used to run queries in commands and behavior packs.

List of tag types[edit | edit source]

This section lists the tag types that are used by the game to affect its behavior in various ways, as well as those that are populated by default, even if the game does not use them to control some behavior.

Java Edition[edit | edit source]

It is possible to defined tags for any registry. The list below show only the ones used by the game.

Bedrock Edition[edit | edit source]

History[edit | edit source]

[hide]Java Edition
1.1317w49aAdded tags type for blocks and items.
17w49bFunctions can now be tagged.
18w19aAdded fluids tag type.
1.1418w43aAdded entitys tag type.
1.16.220w30aAdded the replace property in tag.
Release Candidate 1Entries in a tag can now be optional with the required property.
1.16.520w49aAdded game events tag type.
1.18.222w06aTags can now be defined for any type in the registry, rather than only blocks, items, fluids, entity types, game events and functions previously.
1.18.222w07aAdded biome tags.
1.1922w11aAdded world preset and flat level generator preset tags.
Added structure tags.
22w14aAdded cat variant and point of interest tags.
22w16aAdded painting variant tags.
22w18aAdded banner pattern and instrument tags.
1.19.423w06aAdded damage type tags.
1.20.5Pre-release 1Added enchantment tags.
[hide]Bedrock Edition
?Added tags for blocks, items, and biomes.
1.19.40Preview 1.19.40.22Added new item tags.
1.20.50Preview 1.20.50.20The way an item can be tagged has been changed.
1.20.60Preview 1.20.60.24The way a biome can be tagged has been changed.

Issues[edit | edit source]

Issues relating to "Tag" are maintained on the bug tracker. Issues should be reported and viewed there.

Navigation[edit | edit source]