Block Tags
方块标签可用于确保方块满足特定条件。
应用标签
方块标签可以在方块的 components 中应用,前缀为 tag:,如下所示:
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": {}
}
}
}检测标签
通过方块描述符
q.all_tagsq.any_tag
Block Descriptor
json
{
"tags": "q.any_tag('wiki:glowing') && q.all_tags('wiki:custom_ore', 'stone')"
}通过实体
q.relative_block_has_all_tagsq.relative_block_has_any_tagq.block_has_all_tagsq.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');"
]
}其他查询
注意: 以下查询函数目前没有已知的用例。
q.block_neighbor_has_all_tagsq.block_neighbor_has_any_tag
以下是一个物品检测方块标签的示例:
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')"
}
}
]
}
}
}
}原版标签列表
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 |
|
贡献者
编辑 Block Tags本页面上的文本和图像内容根据 知识共享署名 4.0 国际许可协议
本页中的代码示例根据 MIT 许可证











