Block Tags
Block tags are used when checking for multiple types of block and can enable vanilla functionality. For a list of vanilla block tags and their functionality, visit this page.
Applying Tags
Block tags can be applied in the block's components, prefixed with tag:, as seen below:
BP/blocks/tree_stump.json
json
{
"format_version": "1.21.130",
"minecraft:block": {
"description": {
"identifier": "wiki:tree_stump",
"menu_category": {
"category": "nature"
}
},
"components": {
"tag:wood": {},
"tag:minecraft:is_axe_item_destructible": {},
"tag:wiki:very_useless": {}
}
}
}Testing for Tags
From Block Descriptors
q.all_tags(...tags)- Returns whether the block has all of the listed tags.
q.any_tag(...tags)- Returns whether the block has at least one of the listed tags.
Block Descriptor
json
{
"tags": "q.any_tag('wiki:glowing') && q.all_tags('wiki:custom_ore', 'stone')"
}From Entities
q.block_has_all_tags(x, y, z, ...tags)- Returns whether the block at the specified coordinates has all of the listed tags.
q.block_has_any_tag(x, y, z, ...tags)- Returns whether the block at the specified coordinates has at least one of the listed tags.
q.relative_block_has_all_tags(x, y, z, ...tags)- Returns whether the block at the specified offset from the entity has all of the listed tags.
q.relative_block_has_any_tag(x, y, z, ...tags)- Returns whether the block at the specified offset from the entity has at least one of the listed tags.
minecraft:client_entity > description
json
"scripts": {
"pre_animation": [
"v.is_on_sand = q.relative_block_has_any_tag(0, -1, 0, 'sand');"
]
}Additional Queries
NOTE: The following query functions have no known use cases.
q.block_neighbor_has_all_tags(x, y, z, ...tags)q.block_neighbor_has_any_tag(x, y, z, ...tags)
Digger Example
Example of an item querying a block's tags:
BP/items/custom_pickaxe.json
json
{
"format_version": "1.21.130",
"minecraft:item": {
"description": {
"identifier": "wiki:custom_pickaxe",
"menu_category": {
"category": "equipment",
"group": "minecraft:itemGroup.name.pickaxe"
}
},
"components": {
"minecraft:digger": {
"use_efficiency": true,
"destroy_speeds": [
{
"speed": 5,
"block": {
"tags": "q.any_tag('minecraft:is_pickaxe_item_destructible')"
}
}
]
}
}
}
}Contributors
Edit Block Tags on GitHubText and image content on this page is licensed under the Creative Commons Attribution 4.0 International License
Code samples on this page are licensed under the MIT License











