Block Tags
Block tags can be used to ensure that a block meets certain conditions.
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.70",
"minecraft:block": {
"description": {
"identifier": "wiki:tree_stump",
"menu_category": {
"category": "nature"
}
},
"components": {
"tag:wood": {},
"tag:my_lovely_tag": {},
"tag:wiki:very_useless": {}
}
}
}
Testing for Tags
From Block Descriptors
q.all_tags
q.any_tag
Block Descriptor
json
{
"tags": "q.any_tag('wiki:glowing') && q.all_tags('wiki:custom_ore', 'stone')"
}
From Entities
q.relative_block_has_all_tags
q.relative_block_has_any_tag
q.block_has_all_tags
q.block_has_any_tag
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
q.block_neighbor_has_any_tag
Example of an item querying a block's tags:
BP/items/custom_pickaxe.json
json
{
"format_version": "1.21.70",
"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('custom_ore', 'stone', 'metal')"
}
}
]
}
}
}
}
List of Vanilla Tags
Tag | Vanilla Usage | Functionality |
---|---|---|
acacia |
| |
birch |
| |
dark_oak |
| |
diamond_pick_diggable |
| Deprecated — check for the minecraft:is_pickaxe_item_destructible and minecraft:diamond_tier_destructible tags instead. |
dirt |
| Allows trees to be placed on this block during world generation. The block will be replaced with Dirt if a tree does generated above it. Also allows some plants to be placed on the block, including Bamboo, Cactus Flower, Dead Bush, Pink Petals, Sugar Cane and Wildflowers. |
fertilize_area |
| |
grass |
| |
gravel |
| |
iron_pick_diggable |
| Deprecated — check for the minecraft:is_pickaxe_item_destructible and minecraft:iron_tier_destructible tags instead. |
jungle |
| |
log |
| |
metal |
| |
minecraft:crop |
| |
minecraft:diamond_tier_destructible |
| Indicates that the block must be destroyed by a diamond tier tool in order to drop. This does not automatically prevent drops for custom blocks. |
minecraft:iron_tier_destructible |
| Indicates that the block must be destroyed by an iron tier tool in order to drop. This does not automatically prevent drops for custom blocks. |
minecraft:is_axe_item_destructible |
| Instructs axes to mine this block faster. Custom axes should check for this tag in their digger component. |
minecraft:is_hoe_item_destructible |
| Instructs hoes to mine this block faster. Custom hoes should check for this tag in their digger component. |
minecraft:is_pickaxe_item_destructible |
| Instructs pickaxes to mine this block faster. Custom pickaxes should check for this tag in their digger component. |
minecraft:is_shears_item_destructible |
| Instructs shears to mine this block faster. Custom shears should check for this tag in their digger component. |
minecraft:is_shovel_item_destructible |
| Instructs shovels to mine this block faster. Custom shovels should check for this tag in their digger component. |
minecraft:is_sword_item_destructible |
| Instructs swords to mine this block faster. Custom swords should check for this tag in their digger component. |
minecraft:stone_tier_destructible |
| Indicates that the block must be destroyed by a stone tier tool in order to drop. This does not automatically prevent drops for custom blocks. |
mob_spawner |
| |
not_feature_replaceable |
| |
oak |
| |
one_way_collidable |
| Prevents entities inside a block from being automatically pushed out of the block's collision. |
plant |
| |
pumpkin |
| |
rail |
| |
sand |
| Allows cacti to be placed on the block. |
snow |
| |
spruce |
| |
stone_pick_diggable |
| Deprecated — check for the minecraft:is_pickaxe_item_destructible and minecraft:stone_tier_destructible tags instead. |
stone |
| |
text_sign |
| |
trapdoors |
| Trapdoors are avoided by the Breeze. |
water |
| |
wood |
|
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