> For the complete documentation index, see [llms.txt](https://youyi580.gitbook.io/cog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://youyi580.gitbook.io/cog/recipe/tag.md).

# 标签

标签（Tag）是 1.13 Mojang 新引入的概念，与 Forge 的矿物词典相似（且完全取代），且泛用性更高。物品标签与矿物词典类似，可让配方使用不同物品（如合成工作台可以用不同种类的木板）。方块标签用于指定方块的一些特殊属性。

更多信息见 [原版 Wiki](https://minecraft-zh.gamepedia.com/%E6%A0%87%E7%AD%BE)

## 导出

你可以用指令 `/ct dump tags` 导出游戏内所有 Tag ID。

## 尖括号调用

标签在 zs 的尖括号调用以 `tag` 开头，此外需要再指定其的类型 `<tag:items:forge:ingots/copper>` => 铜锭。即其格式为 `<tag:type:namespace:path>`

标签类型有下面几个：

* items 物品标签，作用于旧版本 Forge 的矿物词典类似
* fluids 流体标签，默认有 `<tag:fluids:minecraft:lava>` 和 `<tag:fluids:minecraft:water>`，用于指定流体的行为
* blocks 方块标签，可以指定方块的一些行为
* entity\_types 实体标签

## 修改

标签的操作与旧版本的矿物词典非常相似。不过标签名都是和物品 ID 一样，有命名空间的。

```javascript
var wool = <tag:items:minecraft:wool>;
for item in wool.elements {
    println(wool.commandString + " contains: " + item.commandString);
}


var out = <item:minecraft:string> * 4;
craftingTable.addShapeless("wool2string", out, [<tag:items:minecraft:wool>]); // 将 Tag 作为合成配方

// 添加与移除物品
<tag:items:minecraft:planks>.add(<item:minecraft:glass>);
<tag:items:minecraft:wool>.remove(<item:minecraft:white_wool>);

// 添加标签
<tag:items:crafttweaker:ingots>.add(<item:minecraft:iron_ingot>, <item:minecraft:gold_ingot>);

craftingTable.addShapeless("new_tag_test", <item:minecraft:diamond>, [<tag:items:crafttweaker:ingots>,<tag:items:crafttweaker:ingots>,<tag:items:crafttweaker:ingots>]);

<tag:blocks:minecraft:wither_immune>.add(<blockstate:minecraft:stone>); 
// 石头将抵御凋灵爆炸
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://youyi580.gitbook.io/cog/recipe/tag.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
