TagManager<T : 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.

导入相关包

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

已实现的接口

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

方法

exists

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

Return Type: boolean

TagManager.exists(location as MCResourceLocation) as boolean
参数类型描述
位置MCResourceLocationThe resource location to check for
exists

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

Return Type: boolean

TagManager.exists(name as string) as boolean
参数类型描述
namestringThe resource location to check for
getAllTags

Retrieves a list of all tags currently registered.

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

TagManager.getAllTags() as stdlib.List<MCTag<T>>
myTagManager.getAllTags();
getAllTagsFor

Retrieves all tags contain the provided element

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

TagManager.getAllTagsFor(element as T) as stdlib.List<MCTag<T>>
参数类型描述
elementTThe element whose tags should be returned
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.

Return Type: MCTag<T>

TagManager.getTag(location as MCResourceLocation) as MCTag<T>
参数类型描述
位置MCResourceLocationThe Resource location of the tag
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.

Return Type: MCTag<T>

TagManager.getTag(name as string) as MCTag<T>
参数类型描述
namestringThe Resource location of the tag
getTagFolder

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

{

Return Type: string

TagManager.getTagFolder() as string
myTagManager.getTagFolder();

运算符

CONTAINS

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

name as string in myTagManager

参数

名称类型可获得可设置
allstdlib.List<MCTag<T>>truefalse
tagTypestringtruefalse