TagManager<T : Object>

Link to tagmanagert--object

TagManagers are used to handle the different types of Tags within the game. They can be retrieved directly with the TagManager BEP, and are also used indirectly when creating a tag with the Tag BEP.

Importare la Classe

Link to importare-la-classe

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.

ZenScript
Copy
import crafttweaker.api.tag.TagManager;

Interfacce Implementate

Link to interfacce-implementate

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

Name: exists

Checks if a tag already exists. Does the same as calling .exists on a tag directly

Returns: Whether or not this tag already exists
Return Type: boolean

ZenScript
Copy
TagManager.exists(location as MCResourceLocation) as boolean
ParametroTipoDescrizione
Parametro
posizione
Tipo
MCResourceLocation
Descrizione
The resource location to check for

Name: exists

Checks if a tag already exists. Does the same as calling .exists on a tag directly

Returns: Whether or not this tag already exists
Return Type: boolean

ZenScript
Copy
TagManager.exists(name as string) as boolean
ParametroTipoDescrizione
Parametro
nome
Tipo
string
Descrizione
The resource location to check for

Name: getAllTags

Retrieves a list of all tags currently registered.

Return Type: stdlib.List<MCTag<T>>

ZenScript
Copy
// TagManager.getAllTags() as stdlib.List<MCTag<T>>

myTagManager.getAllTags();

Name: getAllTagsFor

Retrieves all tags contain the provided element

Return Type: stdlib.List<MCTag<T>>

ZenScript
Copy
TagManager.getAllTagsFor(element as T) as stdlib.List<MCTag<T>>
ParametroTipoDescrizione
Parametro
element
Tipo
T
Descrizione
The element whose tags should be returned

Name: getTag

Retrieves a tag by its name. Will also be called by the BEP.

Note that this method does not yet create the tag if it does not exist. Adding something to the object created by this tag will create it for the game.

Returns: A Tag object.
Return Type: MCTag<T>

ZenScript
Copy
TagManager.getTag(location as MCResourceLocation) as MCTag<T>
ParametroTipoDescrizione
Parametro
posizione
Tipo
MCResourceLocation
Descrizione
The Resource location of the tag

Name: getTag

Retrieves a tag by its name. Will also be called by the BEP.

Note that this method does not yet create the tag if it does not exist. Adding something to the object created by this tag will create it for the game.

Returns: A Tag object.
Return Type: MCTag<T>

ZenScript
Copy
TagManager.getTag(name as string) as MCTag<T>
ParametroTipoDescrizione
Parametro
nome
Tipo
string
Descrizione
The Resource location of the tag

Name: getTagFolder

Get the tag type. In a Bracket call, this will used to determine which TagManager to use.

<tag:{tag_type:tag_location:tag_name>}
<tagManager:{tag_type>}

Return Type: string

ZenScript
Copy
// TagManager.getTagFolder() as string

myTagManager.getTagFolder();

Name: CONTAINS

Checks if a tag already exists. Does the same as calling .exists on a tag directly

ZenScript
Copy
name as string in myTagManager
NomeTipoHa GetterHa SetterDescrizione
Nome
all
Tipo
stdlib.List<MCTag<T>>
Ha Getter
Ha Setter
no
Descrizione
Retrieves a list of all tags currently registered.
Nome
tagType
Tipo
string
Ha Getter
Ha Setter
no
Descrizione
Get the tag type. In a Bracket call, this will used to determine which TagManager to use.

<tag:{tag_type:tag_location:tag_name>}

<tagManager:{tag_type>}