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
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 type | Is Implicit |
---|---|
Result type MCTagWithAmount<T> | Is Implicit true |
Result type string | Is Implicit true |
Methods
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
Parameter | Type | Description |
---|---|---|
Parameter items | Type stdlib.List<T> | Description 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>]);
Parameter | Type | Description |
---|---|---|
Parameter items | Type T[] | Description The items to add. Can be one or more items. |
Adds the given tag to this tag. Creates the tag if it does not exist.
Return Type: void
// MCTag.add(tag as MCTag<T>) as void
<tag:items:forge:gems>.add(<tag:items:forge:rods>);
Parameter | Type | Description |
---|---|---|
Parameter tag | Type MCTag<T> | Description The tag to add. |
Adds the given tags to this tag. Creates the tag if it does not exist.
Return Type: void
// MCTag.addTags(tags as stdlib.List<MCTag<T>>) as void
<tag:items:forge:gems>.addTags(<tag:items:forge:rods>);
Parameter | Type | Description |
---|---|---|
Parameter tags | Type stdlib.List<MCTag<T>> | Description The tags to add. |
Return Type: MCTagWithAmount<T>
// MCTag.asTagWithAmount() as MCTagWithAmount<T>
<tag:items:forge:gems>.asTagWithAmount();
Return Type: boolean
MCTag.contains(element as T) as boolean
Parameter | Type | Description |
---|---|---|
Parameter element | Type T | Description No Description Provided |
Return Type: boolean
// MCTag.exists() as boolean
<tag:items:forge:gems>.exists();
Return Type: stdlib.List<T>
// MCTag.getElements() as stdlib.List<T>
<tag:items:forge:gems>.getElements();
Return Type: MCResourceLocation
// MCTag.getId() as MCResourceLocation
<tag:items:forge:gems>.getId();
Return Type: TagManager<T>
// MCTag.getManager() as TagManager<T>
<tag:items:forge:gems>.getManager();
Return Type: void
MCTag.remove(items as stdlib.List<T>) as void
Parameter | Type | Description |
---|---|---|
Parameter items | Type stdlib.List<T> | Description No Description Provided |
Return Type: void
MCTag.remove(items as T[]) as void
Parameter | Type | Description |
---|---|---|
Parameter items | Type T[] | Description No Description Provided |
Return Type: void
MCTag.remove(tag as MCTag<T>) as void
Parameter | Type | Description |
---|---|---|
Parameter tag | Type MCTag<T> | Description No Description Provided |
Return Type: MCTagWithAmount<T>
MCTag.withAmount(amount as int) as MCTagWithAmount<T>
Parameter | Type | Description |
---|---|---|
Parameter amount | Type int | Description No Description Provided |
Operators
element as T in myMCTag
myMCTag == other as MCTag<T>
myMCTag * amount as int
Properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name elements | Type stdlib.List<T> | Has Getter true | Has Setter false | Description No Description Provided |
Name exists | Type boolean | Has Getter true | Has Setter false | Description No Description Provided |
Name id | Type MCResourceLocation | Has Getter true | Has Setter false | Description No Description Provided |
Name manager | Type TagManager<T> | Has Getter true | Has Setter false | Description No Description Provided |