Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

MCTag

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.MCTag;

Description

Loaders

This type is available in the following loaders:

  • crafttweaker
  • tags

Implements

MCTag implements the following interfaces:

CommandStringDisplayable

Undocumented Interfaces

Comparable<MCTag>

Operators

in(id as ResourceLocation) as bool
Checks if this tag contains an element with the given id
script.zs
// ((id as ResourceLocation) in MCTag) as bool
myResourceLocation in <tag:items:minecraft:wool>

Parameters:

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

Return Type: bool

==(other as MCTag) as bool
Checks if this tag equals the other tag.
script.zs
// (MCTag == (other as MCTag)) as bool
<tag:items:minecraft:wool> == myMCTag

Parameters:

other Type: MCTag - The tag to check against.

Return Type: bool

Members

add(tags as MCTag[])
Adds the given tags to this tag.
script.zs
// MCTag.add(tags as MCTag[]);
<tag:items:minecraft:wool>.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
// MCTag.addId(elements as ResourceLocation[]);
<tag:items:minecraft:wool>.addId(<resource:minecraft:diamond>);

Parameters:

elements Type: ResourceLocation[] - The registry key of the elements to add.
clear()
Removes all elements in this tag.
script.zs
// MCTag.clear();
<tag:items:minecraft:wool>.clear();
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
// MCTag.contains(id as ResourceLocation) as bool;
<tag:items:minecraft:wool>.contains(<resource:minecraft:white_wool>);

Parameters:

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

Return Type: bool

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
// MCTag.equals(other as MCTag) as bool;
<tag:items:minecraft:wool>.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
// MCTag.exists as bool
<tag:items:minecraft:wool>.exists

Return Type: bool

exists() as bool
Checks if this tag exists.

Returns: true if this tag exists, false otherwise.

script.zs
// MCTag.exists() as bool;
<tag:items:minecraft:wool>.exists();

Return Type: bool

Getter
Gets the id of this tag.
script.zs
// MCTag.id as ResourceLocation
<tag:items:minecraft:wool>.id

Return Type: ResourceLocation

id() as ResourceLocation
Gets the id of this tag.

Returns: The id of this tag.

script.zs
// MCTag.id() as ResourceLocation;
<tag:items:minecraft:wool>.id();

Return Type: ResourceLocation

Getter
Gets the id's of the elements in this tag.
script.zs
// MCTag.idElements as List<ResourceLocation>
<tag:items:minecraft:wool>.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
// MCTag.idElements() as List<ResourceLocation>;
<tag:items:minecraft:wool>.idElements();

Return Type: List<ResourceLocation>

remove(tags as MCTag[])
Removes the given tags from this tag.
script.zs
// MCTag.remove(tags as MCTag[]);
<tag:items:minecraft:wool>.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
// MCTag.removeId(elements as ResourceLocation[]);
<tag:items:minecraft:wool>.removeId(<resource:minecraft:diamond>);

Parameters:

elements Type: ResourceLocation[] - The registry key of the elements to remove.