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

ITagManager

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.manager.ITagManager;

Description

Loaders

This type is available in the following loaders:

  • crafttweaker
  • tags

Implements

ITagManager<MCTag> implements the following interfaces:

CommandStringDisplayable

Undocumented Interfaces

Iterable<MCTag>,Comparable<ITagManager<?>>

Operators

in(id as string) as bool
Checks if a tag with the given id exists and is registered.
script.zs
// ((id as string) in ITagManager<T : MCTag>) as bool
myString in myITagManager

Parameters:

id Type: string - The id of the tag to check.

Return Type: bool

in(id as ResourceLocation) as bool
Checks if a tag with the given id exists and is registered.
script.zs
// ((id as ResourceLocation) in ITagManager<T : MCTag>) as bool
myResourceLocation in myITagManager

Parameters:

id Type: ResourceLocation - The id of the tag to check.

Return Type: bool

in(tag as MCTag) as bool
Checks if the given tag exists and is registered.
script.zs
// ((tag as MCTag) in ITagManager<T : MCTag>) as bool
myT in myITagManager

Parameters:

tag Type: MCTag - The tag to check.

Return Type: bool

Members

addId(to as MCTag, values as ResourceLocation[])
Adds the elements that correspond to the given ResourceLocation to the given tag.
script.zs
// ITagManager<T : MCTag>.addId(to as MCTag, values as ResourceLocation[]);
myITagManager.addId(<tag:items:minecraft:wool>, <resource:minecraft:diamond>);

Parameters:

to Type: MCTag - The tag to add to.
values Type: ResourceLocation[] - The registry key of the elements to add.
clear(from as MCTag)
Clears all values of the given tag.
script.zs
// ITagManager<T : MCTag>.clear(from as MCTag);
myITagManager.clear(<tag:items:minecraft:wool>);

Parameters:

from Type: MCTag - The tag to clear.
exists(id as string) as bool
Checks if a tag with the given id exists and is registered.

Returns: true if it exists, false otherwise.

script.zs
// ITagManager<T : MCTag>.exists(id as string) as bool;
myITagManager.exists("minecraft:wool");

Parameters:

id Type: string - The id of the tag to check.

Return Type: bool

exists(id as ResourceLocation) as bool
Checks if a tag with the given id exists and is registered.

Returns: true if it exists, false otherwise.

script.zs
// ITagManager<T : MCTag>.exists(id as ResourceLocation) as bool;
myITagManager.exists(<resource:minecraft:wool>);

Parameters:

id Type: ResourceLocation - The id of the tag to check.

Return Type: bool

exists(tag as MCTag) as bool
Checks if the given tag exists and is registered.

Returns: true if it exists, false otherwise.

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

Parameters:

tag Type: MCTag - The tag to check.

Return Type: bool

getTagsFor(element as ResourceLocation) as List<MCTag>
Ges the tags that contain the given element.
This method needs to be overriden with a covariant return type and exposed to ZenCode.

Returns: The tags that contain the given elements.

script.zs
// ITagManager<T : MCTag>.getTagsFor(element as ResourceLocation) as List<MCTag>;
myITagManager.getTagsFor(myResourceLocation);

Parameters:

Return Type: List<MCTag>

idElements(of as MCTag) as List<ResourceLocation>
Gets the ResourceLocation ids of the elements in the given tag.

Returns: A List of ResourceLocation ids of the elements in the given tag.

script.zs
// ITagManager<T : MCTag>.idElements(of as MCTag) as List<ResourceLocation>;
myITagManager.idElements(<tag:items:minecraft:wool>);

Parameters:

of Type: MCTag - The tag to get the elements of.

Return Type: List<ResourceLocation>

removeId(from as MCTag, values as ResourceLocation[])
Removes the elements that correspond to the given ResourceLocation from the given tag.
script.zs
// ITagManager<T : MCTag>.removeId(from as MCTag, values as ResourceLocation[]);
myITagManager.removeId(<tag:items:minecraft:wool>, <resource:minecraft:diamond>);

Parameters:

from Type: MCTag - The tag to remove from.
values Type: ResourceLocation[] - The registry key of the elements to remove.
tag(id as string) as MCTag
Gets a tag with the given id.

Returns: A tag with the given id.

script.zs
// ITagManager<T : MCTag>.tag(id as string) as MCTag;
myITagManager.tag("minecraft:wool");

Parameters:

id Type: string - The id of the tag.

Return Type: MCTag

tag(id as ResourceLocation) as MCTag
Gets a tag with the given id.

Returns: A tag with the given id.

script.zs
// ITagManager<T : MCTag>.tag(id as ResourceLocation) as MCTag;
myITagManager.tag(<resource:minecraft:wool>);

Parameters:

id Type: ResourceLocation - The id of the tag.

Return Type: MCTag

Getter
Gets the tagFolder of this manager.

The tag folder is usually the folder on disk without the tags/ prefix.


Examples:



  1. tags/items turns into items

  2. tags/potion turns into potion

  3. tags/worldgen/biome turns into worldgen/biome
script.zs
// ITagManager<T : MCTag>.tagFolder as string
myITagManager.tagFolder

Return Type: string

tagFolder() as string
Gets the tagFolder of this manager.

The tag folder is usually the folder on disk without the tags/ prefix.


Examples:



  1. tags/items turns into items

  2. tags/potion turns into potion

  3. tags/worldgen/biome turns into worldgen/biome

Returns: The tag folder of this manager.

script.zs
// ITagManager<T : MCTag>.tagFolder() as string;
myITagManager.tagFolder();

Return Type: string

Getter
Gets the keys of the tags that this manager knows about.
script.zs
// ITagManager<T : MCTag>.tagKeys as List<ResourceLocation>
myITagManager.tagKeys

Return Type: List<ResourceLocation>

tagKeys() as List<ResourceLocation>
Gets the keys of the tags that this manager knows about.

Returns: A List of keys of the tags that this manager knows about.

script.zs
// ITagManager<T : MCTag>.tagKeys() as List<ResourceLocation>;
myITagManager.tagKeys();

Return Type: List<ResourceLocation>

Getter
Gets a map of id to tag that this manager knows about.
script.zs
// ITagManager<T : MCTag>.tagMap as MCTag[ResourceLocation]
myITagManager.tagMap

Return Type: MCTag[ResourceLocation]

tagMap() as MCTag[ResourceLocation]
Gets a map of id to tag that this manager knows about.

Returns: a map of id to tag.

script.zs
// ITagManager<T : MCTag>.tagMap() as MCTag[ResourceLocation];
myITagManager.tagMap();

Return Type: MCTag[ResourceLocation]

Getter
Ges the tags that this manager knows about.
This method needs to be overriden with a covariant return type and exposed to ZenCode.
script.zs
// ITagManager<T : MCTag>.tags as List<MCTag>
myITagManager.tags

Return Type: List<MCTag>

tags() as List<MCTag>
Ges the tags that this manager knows about.
This method needs to be overriden with a covariant return type and exposed to ZenCode.

Returns: The tags that this manager knows about.

script.zs
// ITagManager<T : MCTag>.tags() as List<MCTag>;
myITagManager.tags();

Return Type: List<MCTag>