MCTag<T : Object>
Link to mctagt--object
A reference to a Tag object. Note that this tag may not exist in the game already, such as when you create new tags. See the MCTag<T>#exists() Method on whether or not this tag already exists.
A tag will be created as soon as you add
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.tag.MCTag;
已实现的接口
Link to 已实现的接口
MCTag implements the following interfaces. That means all methods defined in these interfaces are also available in MCTag
Casters
Link to casters
结果类型 | 是否隐藏 |
---|---|
结果类型 MCTagWithAmount<T> | 是否隐藏 true |
结果类型 string | 是否隐藏 true |
使用方式
Link to 使用方式
Name: add
Adds the given items to the tag. Creates the tag if it does not exist.
Return Type: void
ZenScript CopyMCTag.add(items as stdlib.List<T>) as void
参数 | 类型 | 描述 |
---|---|---|
参数 items | 类型 stdlib.List<T> | 描述 The items to add. Provided as list. |
Name: add
Adds the given items to the tag. Creates the tag if it does not exist.
Return Type: void
ZenScript Copy// MCTag.add(items as T[]) as void
<tag:items:forge:gems>.add(<item:minecraft:bedrock>);
<tag:items:forge:gems>.add(<item:minecraft:iron_ingot>, <item:minecraft:gold_ingot>);
<tag:items:forge:gems>.add([<item:minecraft:iron_ingot>, <item:minecraft:gold_ingot>]);
参数 | 类型 | 描述 |
---|---|---|
参数 items | 类型 T[] | 描述 The items to add. Can be one or more items. |
Name: add
Adds the given tag to this tag. Creates the tag if it does not exist.
Return Type: void
ZenScript Copy// MCTag.add(tag as MCTag<T>) as void
<tag:items:forge:gems>.add(<tag:items:forge:rods>);
参数 | 类型 | 描述 |
---|---|---|
参数 tag #标签 | 类型 MCTag<T> | 描述 The tag to add. |
Name: addTags
Adds the given tags to this tag. Creates the tag if it does not exist.
Return Type: void
ZenScript Copy// MCTag.addTags(tags as stdlib.List<MCTag<T>>) as void
<tag:items:forge:gems>.addTags(<tag:items:forge:rods>);
参数 | 类型 | 描述 |
---|---|---|
参数 tags | 类型 stdlib.List<MCTag<T>> | 描述 The tags to add. |
Name: asTagWithAmount
Return Type: MCTagWithAmount<T>
ZenScript Copy// MCTag.asTagWithAmount() as MCTagWithAmount<T>
<tag:items:forge:gems>.asTagWithAmount();
Name: contains
Return Type: boolean
ZenScript CopyMCTag.contains(element as T) as boolean
参数 | 类型 | 描述 |
---|---|---|
参数 element | 类型 T | 描述 No Description Provided |
Name: exists
Return Type: boolean
ZenScript Copy// MCTag.exists() as boolean
<tag:items:forge:gems>.exists();
Name: getElements
Return Type: stdlib.List<T>
ZenScript Copy// MCTag.getElements() as stdlib.List<T>
<tag:items:forge:gems>.getElements();
Name: getId
Return Type: MCResourceLocation
ZenScript Copy// MCTag.getId() as MCResourceLocation
<tag:items:forge:gems>.getId();
Name: getManager
Return Type: TagManager<T>
ZenScript Copy// MCTag.getManager() as TagManager<T>
<tag:items:forge:gems>.getManager();
Name: remove
Return Type: void
ZenScript CopyMCTag.remove(items as stdlib.List<T>) as void
参数 | 类型 | 描述 |
---|---|---|
参数 items | 类型 stdlib.List<T> | 描述 No Description Provided |
Name: remove
Return Type: void
ZenScript CopyMCTag.remove(items as T[]) as void
参数 | 类型 | 描述 |
---|---|---|
参数 items | 类型 T[] | 描述 No Description Provided |
Name: remove
Return Type: void
ZenScript CopyMCTag.remove(tag as MCTag<T>) as void
参数 | 类型 | 描述 |
---|---|---|
参数 tag #标签 | 类型 MCTag<T> | 描述 No Description Provided |
Name: withAmount
Return Type: MCTagWithAmount<T>
ZenScript CopyMCTag.withAmount(amount as int) as MCTagWithAmount<T>
参数 | 类型 | 描述 |
---|---|---|
参数 amount | 类型 int | 描述 No Description Provided |
运算符
Link to 运算符
Name: CONTAINS
ZenScript Copyelement as T in myMCTag
Name: EQUALS
ZenScript CopymyMCTag == other as MCTag<T>
Name: MUL
ZenScript CopymyMCTag * amount as int
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 elements | 类型 stdlib.List<T> | 可获得 true | 可设置 false | 描述 No Description Provided |
名称 exists | 类型 布尔值 | 可获得 true | 可设置 false | 描述 No Description Provided |
名称 id | 类型 MCResourceLocation | 可获得 true | 可设置 false | 描述 No Description Provided |
名称 manager | 类型 TagManager<T> | 可获得 true | 可设置 false | 描述 No Description Provided |