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.60",
"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.60",
"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 |
---|---|
acacia |
|
birch |
|
dark_oak |
|
diamond_pick_diggable |
|
dirt |
|
fertilize_area |
|
grass |
|
gravel |
|
iron_pick_diggable |
|
jungle |
|
log |
|
metal |
|
minecraft:crop |
|
minecraft:diamond_tier_destructible |
|
minecraft:iron_tier_destructible |
|
minecraft:is_axe_item_destructible |
|
minecraft:is_hoe_item_destructible |
|
minecraft:is_pickaxe_item_destructible |
|
minecraft:is_shears_item_destructible |
|
minecraft:is_shovel_item_destructible |
|
minecraft:is_sword_item_destructible |
|
minecraft:stone_tier_destructible |
|
mob_spawner |
|
not_feature_replaceable |
|
oak |
|
one_way_collidable |
|
plant |
|
pumpkin |
|
rail |
|
sand |
|
snow |
|
spruce |
|
stone_pick_diggable |
|
stone |
|
text_sign |
|
trapdoors |
|
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