MCTag<T : Object>

A reference to a Tag object. Note that this tag may not exist in the game already, such as when you create new tags. See the MCTag<T>#exists() Method on whether or not this tag already exists.

A tag will be created as soon as you add

This class was added by a mod with mod-id crafttweaker. So you need to have this mod installed if you want to use this feature.

Importing the class

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.

import crafttweaker.api.tag.MCTag;

Implemented Interfaces

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

Casters

Result typeIs Implicit
stringtrue

Methods

add

Adds the given items to the tag. Creates the tag if it does not exist.

Return Type: void

MCTag.add(items as stdlib.List<T>) as void
ParameterTypeDescription
itemsstdlib.List<T>The items to add. Provided as list.

Adds the given items to the tag. Creates the tag if it does not exist.

Return Type: void

MCTag.add(items as T[]) as void
<tag:items:forge:gems>.add(<item:minecraft:bedrock>);
<tag:items:forge:gems>.add(<item:minecraft:iron_ingot>, <item:minecraft:gold_ingot>);
<tag:items:forge:gems>.add([<item:minecraft:iron_ingot>, <item:minecraft:gold_ingot>]);
ParameterTypeDescription
itemsT[]The items to add. Can be one or more items.

contains

Return Type: boolean

MCTag.contains(element as T) as boolean
ParameterTypeDescription
elementTNo Description Provided

exists

Return Type: boolean

MCTag.exists() as boolean
<tag:items:forge:gems>.exists();

getElements

Return Type: stdlib.List<T>

MCTag.getElements() as stdlib.List<T>
<tag:items:forge:gems>.getElements();

getId

Return Type: MCResourceLocation

MCTag.getId() as MCResourceLocation
<tag:items:forge:gems>.getId();

getManager

Return Type: TagManager<T>

MCTag.getManager() as TagManager<T>
<tag:items:forge:gems>.getManager();

remove

Return Type: void

MCTag.remove(items as stdlib.List<T>) as void
ParameterTypeDescription
itemsstdlib.List<T>No Description Provided

Return Type: void

MCTag.remove(items as T[]) as void
ParameterTypeDescription
itemsT[]No Description Provided

Operators

CONTAINS

element as T in myMCTag

EQUALS

myMCTag == other as MCTag<T>

Properties

NameTypeHas GetterHas Setter
elementsstdlib.List<T>truefalse
existsbooleantruefalse
idMCResourceLocationtruefalse
managerTagManager<T>truefalse