KnownTag

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.tag.type.KnownTag;

Description

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

Implements

KnownTag<T> implements the following interfaces:

MCTag,CommandStringDisplayable

Undocumented Interfaces

Iterable<T>,Comparable<MCTag>

Operators

in(element as T) as bool
script.zs
// ((element as T) in KnownTag<T>) as bool
myT in myKnownTag

Parameters:

element Type: T

Return Type: bool

==(other as MCTag) as bool
Checks if this tag equals the other tag.
script.zs
// (KnownTag<T> == (other as MCTag)) as bool
myKnownTag == myMCTag

Parameters:

other Type: MCTag - The tag to check against.

Return Type: bool

*(amount as int) as Many<KnownTag<T>>
script.zs
// (KnownTag<T> * (amount as int)) as Many<KnownTag<T>>
myKnownTag * myInt

Parameters:

amount Type: int

Return Type: Many<KnownTag<T>>

Members

add(elements as T[])
script.zs
// KnownTag<T>.add(elements as T[]);
myKnownTag.add(myT[]);

Parameters:

elements Type: T[]
add(tags as MCTag[])
Adds the given tags to this tag.
script.zs
// KnownTag<T>.add(tags as MCTag[]);
myKnownTag.add(<tag:items:minecraft:wool>);

Parameters:

tags Type: MCTag[] - The tags to add.
addId(elements as ResourceLocation[])
Adds the elements that correspond to the given ResourceLocation to this tag.
script.zs
// KnownTag<T>.addId(elements as ResourceLocation[]);
myKnownTag.addId(<resource:minecraft:diamond>);

Parameters:

elements Type: ResourceLocation[] - The registry key of the elements to add.
asTagWithAmount() as Many<KnownTag<T>>
script.zs
// KnownTag<T>.asTagWithAmount() as Many<KnownTag<T>>;
myKnownTag.asTagWithAmount();

Return Type: Many<KnownTag<T>>

implicit as Many<KnownTag<T>>
script.zs
// KnownTag<T> as Many<KnownTag<T>>
myKnownTag as Many<KnownTag<T>>

Return Type: Many<KnownTag<T>>

clear()
Removes all elements in this tag.
script.zs
// KnownTag<T>.clear();
myKnownTag.clear();
Getter
Returns the BEP to get this thingy
script.zs
// KnownTag<T>.commandString as string
myKnownTag.commandString

Return Type: string

commandString() as string
Returns the BEP to get this thingy
script.zs
// KnownTag<T>.commandString() as string;
myKnownTag.commandString();

Return Type: string

contains(element as T) as bool
script.zs
// KnownTag<T>.contains(element as T) as bool;
myKnownTag.contains(myT);

Parameters:

element Type: T

Return Type: bool

contains(id as ResourceLocation) as bool
Checks if this tag contains an element with the given id

Returns: true if it contains the element, false otherwise.

script.zs
// KnownTag<T>.contains(id as ResourceLocation) as bool;
myKnownTag.contains(<resource:minecraft:white_wool>);

Parameters:

id Type: ResourceLocation - The ID of the element to check.

Return Type: bool

Getter
script.zs
// KnownTag<T>.elements as List<T>
myKnownTag.elements

Return Type: List<T>

elements() as List<T>
script.zs
// KnownTag<T>.elements() as List<T>;
myKnownTag.elements();

Return Type: List<T>

equals(other as MCTag) as bool
Checks if this tag equals the other tag.

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

script.zs
// KnownTag<T>.equals(other as MCTag) as bool;
myKnownTag.equals(<tag:items:minecraft:wool>);

Parameters:

other Type: MCTag - The tag to check against.

Return Type: bool

Getter
Checks if this tag exists.
script.zs
// KnownTag<T>.exists as bool
myKnownTag.exists

Return Type: bool

exists() as bool
Checks if this tag exists.

Returns: true if this tag exists, false otherwise.

script.zs
// KnownTag<T>.exists() as bool;
myKnownTag.exists();

Return Type: bool

Getter
script.zs
// KnownTag<T>.id as ResourceLocation
myKnownTag.id

Return Type: ResourceLocation

id() as ResourceLocation
script.zs
// KnownTag<T>.id() as ResourceLocation;
myKnownTag.id();

Return Type: ResourceLocation

Getter
Gets the id's of the elements in this tag.
script.zs
// KnownTag<T>.idElements as List<ResourceLocation>
myKnownTag.idElements

Return Type: List<ResourceLocation>

idElements() as List<ResourceLocation>
Gets the id's of the elements in this tag.

Returns: The id's elements in this tag.

script.zs
// KnownTag<T>.idElements() as List<ResourceLocation>;
myKnownTag.idElements();

Return Type: List<ResourceLocation>

Getter
script.zs
// KnownTag<T>.manager as KnownTagManager<T>
myKnownTag.manager

Return Type: KnownTagManager<T>

manager() as KnownTagManager<T>
script.zs
// KnownTag<T>.manager() as KnownTagManager<T>;
myKnownTag.manager();

Return Type: KnownTagManager<T>

remove(elements as T[])
script.zs
// KnownTag<T>.remove(elements as T[]);
myKnownTag.remove(myT[]);

Parameters:

elements Type: T[]
remove(tags as MCTag[])
Removes the given tags from this tag.
script.zs
// KnownTag<T>.remove(tags as MCTag[]);
myKnownTag.remove(<tag:items:minecraft:wool>);

Parameters:

tags Type: MCTag[] - The tags to remove.
removeId(elements as ResourceLocation[])
Removes the elements that correspond to the given ResourceLocation from this tag.
script.zs
// KnownTag<T>.removeId(elements as ResourceLocation[]);
myKnownTag.removeId(<resource:minecraft:diamond>);

Parameters:

elements Type: ResourceLocation[] - The registry key of the elements to remove.
implicit as string
script.zs
// KnownTag<T> as string
myKnownTag as string

Return Type: string

withAmount(amount as int) as Many<KnownTag<T>>
script.zs
// KnownTag<T>.withAmount(amount as int) as Many<KnownTag<T>>;
myKnownTag.withAmount(myInt);

Parameters:

amount Type: int

Return Type: Many<KnownTag<T>>