KnownTag<T : Object>

Link to knowntagt--object

A known tag is a tag whose element is known and has been registered as Taggable.

Known tags let you use the actual element to interact with the tag instead of using the registry key of the element

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
Copy
import crafttweaker.api.tag.type.KnownTag;

已实现的接口

Link to 已实现的接口

KnownTag implements the following interfaces. That means all methods defined in these interfaces are also available in KnownTag

  • MCTag
  • stdlib.Iterable<T>
结果类型是否隐藏
结果类型
Many<KnownTag<T>>
是否隐藏
true
结果类型
string
是否隐藏
true

Name: add

Return Type: void

ZenScript
Copy
KnownTag.add(elements as T[]) as void
参数类型描述
参数
elements
类型
T[]
描述
No Description Provided

Name: add

Adds the given tags to this tag.

Return Type: void

ZenScript
Copy
// KnownTag.add(tags as MCTag[]) as void

myKnownTag.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.

Return Type: void

ZenScript
Copy
// KnownTag.addId(elements as ResourceLocation[]) as void

myKnownTag.addId(<resource:minecraft:diamond>);
参数类型描述
参数
elements
类型
ResourceLocation[]
描述
The registry key of the elements to add.

Name: asTagWithAmount

Return Type: Many<KnownTag<T>>

ZenScript
Copy
// KnownTag.asTagWithAmount() as Many<KnownTag<T>>

myKnownTag.asTagWithAmount();

Name: clear

Removes all elements in this tag.

Return Type: void

ZenScript
Copy
// KnownTag.clear() as void

myKnownTag.clear();

Name: contains

Return Type: boolean

ZenScript
Copy
KnownTag.contains(element as T) as boolean
参数类型描述
参数
element
类型
T
描述
No Description Provided

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
// KnownTag.contains(id as ResourceLocation) as boolean

myKnownTag.contains(<resource:minecraft:white_wool>);
参数类型描述
参数
id
类型
资源位置
描述
The ID of the element to check.

Name: elements

Return Type: stdlib.List<T>

ZenScript
Copy
// KnownTag.elements() as stdlib.List<T>

myKnownTag.elements();

Name: equals

Checks if this tag equals the other tag.

Returns: true if the tags are equal, false otherwise.
Return Type: boolean

ZenScript
Copy
// KnownTag.equals(other as MCTag) as boolean

myKnownTag.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
// KnownTag.exists() as boolean

myKnownTag.exists();

Name: id

Return Type: ResourceLocation

ZenScript
Copy
// KnownTag.id() as ResourceLocation

myKnownTag.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
// KnownTag.idElements() as stdlib.List<ResourceLocation>

myKnownTag.idElements();

Name: manager

Return Type: KnownTagManager<T>

ZenScript
Copy
// KnownTag.manager() as KnownTagManager<T>

myKnownTag.manager();

Name: remove

Return Type: void

ZenScript
Copy
KnownTag.remove(elements as T[]) as void
参数类型描述
参数
elements
类型
T[]
描述
No Description Provided

Name: remove

Removes the given tags from this tag.

Return Type: void

ZenScript
Copy
// KnownTag.remove(tags as MCTag[]) as void

myKnownTag.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.

Return Type: void

ZenScript
Copy
// KnownTag.removeId(elements as ResourceLocation[]) as void

myKnownTag.removeId(<resource:minecraft:diamond>);
参数类型描述
参数
elements
类型
ResourceLocation[]
描述
The registry key of the elements to remove.

Name: withAmount

Return Type: Many<KnownTag<T>>

ZenScript
Copy
KnownTag.withAmount(amount as int) as Many<KnownTag<T>>
参数类型描述
参数
amount
类型
int
描述
No Description Provided

Name: CONTAINS

Checks if this tag contains an element with the given id

ZenScript
Copy
id as ResourceLocation in myKnownTag
<resource:minecraft:white_wool> in myKnownTag

Name: EQUALS

Checks if this tag equals the other tag.

ZenScript
Copy
myKnownTag == other as MCTag
myKnownTag == <tag:items:minecraft:wool>

Name: MUL

ZenScript
Copy
myKnownTag * amount as int
名称类型可获得可设置描述
名称
elements
类型
stdlib.List<T>
可获得
true
可设置
false
描述
No Description Provided
名称
exists
类型
布尔值
可获得
true
可设置
false
描述
Checks if this tag exists.
名称
id
类型
资源位置
可获得
true
可设置
false
描述
No Description Provided
名称
idElements
类型
stdlib.List<ResourceLocation>
可获得
true
可设置
false
描述
Gets the id's of the elements in this tag.
名称
manager
类型
KnownTagManager<T>
可获得
true
可设置
false
描述
No Description Provided