MCTag
Link to mctag
导入类
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
- CommandStringDisplayable #命令字符串可显示
- Comparable<MCTag>
使用方式
Link to 使用方式
Name: add
Adds the given tags to this tag.
ZenScript Copy// MCTag.add(tags as MCTag[])
<tag:items:minecraft:wool>.add(<tag:items:minecraft:wool>);
参数 | 类型 | 描述 |
---|---|---|
参数 tags | 类型 MCTag[] | 描述 The tags to add. |
Name: addId
Adds the elements that correspond to the given ResourceLocation to this tag.
ZenScript Copy// MCTag.addId(elements as ResourceLocation[])
<tag:items:minecraft:wool>.addId(<resource:minecraft:diamond>);
参数 | 类型 | 描述 |
---|---|---|
参数 elements | 类型 ResourceLocation[] | 描述 The registry key of the elements to add. |
Name: clear
Removes all elements in this tag.
ZenScript Copy// MCTag.clear()
<tag:items:minecraft:wool>.clear();
Name: contains
Checks if this tag contains an element with the given id
Returns: true if it contains the element, false otherwise.
Return Type: boolean
ZenScript Copy// MCTag.contains(id as ResourceLocation) as boolean
<tag:items:minecraft:wool>.contains(<resource:minecraft:white_wool>);
参数 | 类型 | 描述 |
---|---|---|
参数 id | 类型 资源位置 | 描述 The ID of the element to check. |
Name: equals
Checks if this tag equals the other tag.
Returns: true if the tags are equal, false otherwise.
Return Type: boolean
ZenScript Copy// MCTag.equals(other as MCTag) as boolean
<tag:items:minecraft:wool>.equals(<tag:items:minecraft:wool>);
参数 | 类型 | 描述 |
---|---|---|
参数 other | 类型 MCTag | 描述 The tag to check against. |
Name: exists
Checks if this tag exists.
Returns: true if this tag exists, false otherwise.
Return Type: boolean
ZenScript Copy// MCTag.exists() as boolean
<tag:items:minecraft:wool>.exists();
Name: id
Gets the id of this tag.
Returns: The id of this tag.
Return Type: ResourceLocation
ZenScript Copy// MCTag.id() as ResourceLocation
<tag:items:minecraft:wool>.id();
Name: idElements
Gets the id's of the elements in this tag.
Returns: The id's elements in this tag.
Return Type: stdlib.List<ResourceLocation>
ZenScript Copy// MCTag.idElements() as stdlib.List<ResourceLocation>
<tag:items:minecraft:wool>.idElements();
Name: remove
Removes the given tags from this tag.
ZenScript Copy// MCTag.remove(tags as MCTag[])
<tag:items:minecraft:wool>.remove(<tag:items:minecraft:wool>);
参数 | 类型 | 描述 |
---|---|---|
参数 tags | 类型 MCTag[] | 描述 The tags to remove. |
Name: removeId
Removes the elements that correspond to the given ResourceLocation from this tag.
ZenScript Copy// MCTag.removeId(elements as ResourceLocation[])
<tag:items:minecraft:wool>.removeId(<resource:minecraft:diamond>);
参数 | 类型 | 描述 |
---|---|---|
参数 elements | 类型 ResourceLocation[] | 描述 The registry key of the elements to remove. |
运算符
Link to 运算符
Name: CONTAINS
Checks if this tag contains an element with the given id
ZenScript Copyid as ResourceLocation in myMCTag
<resource:minecraft:white_wool> in <tag:items:minecraft:wool>
Name: EQUALS
Checks if this tag equals the other tag.
ZenScript CopymyMCTag == other as MCTag
<tag:items:minecraft:wool> == <tag:items:minecraft:wool>
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 exists | 类型 布尔值 | 可获得 true | 可设置 false | 描述 Checks if this tag exists. |
名称 id | 类型 资源位置 | 可获得 true | 可设置 false | 描述 Gets the id of this tag. |
名称 idElements | 类型 stdlib.List<ResourceLocation> | 可获得 true | 可设置 false | 描述 Gets the id's of the elements in this tag. |