Interface ITagManager<T extends MCTag>
- All Superinterfaces:
CommandStringDisplayable,Comparable<ITagManager<?>>,Iterable<T>
- All Known Implementing Classes:
EntityTypeTagManager,KnownTagManager,UnknownTagManager
@ZenRegister(loaders={"crafttweaker","tags"})
public interface ITagManager<T extends MCTag>
extends CommandStringDisplayable, Iterable<T>, Comparable<ITagManager<?>>
- DocParam:
- this invalid input: '<'tagmanager:items>
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the elements that correspond to the givenResourceLocationto the given tag.<U> voidaddTag(net.minecraft.resources.ResourceLocation id, Collection<net.minecraft.core.Holder<U>> tag) Adds a tag to this manager with the given id.voidbind(net.minecraft.tags.TagManager.LoadResult<?> result) Binds this manager to the given load result.voidClears all values of the given tag.default intcompareTo(ITagManager<?> o) Gets the element type that this tag manager handles.default booleanChecks if a tag with the given id exists and is registered.default booleanexists(net.minecraft.resources.ResourceLocation id) Checks if a tag with the given id exists and is registered.default booleanChecks if the given tag exists and is registered.default StringGets the command string of this manager.Collection<net.minecraft.core.Holder<?>> getInternalRaw(T tag) getTagsFor(net.minecraft.resources.ResourceLocation element) Ges the tags that contain the given element.default List<net.minecraft.resources.ResourceLocation> idElements(T of) Gets theResourceLocationids of the elements in the given tag.Map<net.minecraft.resources.ResourceLocation, Collection<net.minecraft.core.Holder<?>>> Gets the internal tags of this manager.iterator()voidRecalculates the cached tag map.voidRemoves the elements that correspond to the givenResourceLocationfrom the given tag.net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> Gets the resource key of the registry that this manager deals with.Gets a tag with the given id.tag(net.minecraft.resources.ResourceLocation id) Gets a tag with the given id.default Ttag(net.minecraft.tags.TagKey<?> key) Gets a tag from the givenTagKey.default StringGets the tagFolder of this manager.List<net.minecraft.resources.ResourceLocation> tagKeys()Gets the keys of the tags that this manager knows about.tagMap()Gets a map of id to tag that this manager knows about.tags()Ges the tags that this manager knows about.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
tagFolder
Gets the tagFolder of this manager.The tag folder is usually the folder on disk without the `tags/` prefix.
Examples:
- `tags/items` turns into `items`
- `tags/potion` turns into `potion`
- `tags/worldgen/biome` turns into `worldgen/biome`
- Returns:
- The tag folder of this manager.
-
tag
Gets a tag with the given id.- Parameters:
id- The id of the tag.- Returns:
- A tag with the given id.
- DocParam:
- id "minecraft:wool"
-
tag
Gets a tag with the given id.- Parameters:
id- The id of the tag.- Returns:
- A tag with the given id.
- DocParam:
- id invalid input: '<'resource:minecraft:wool>
-
tagMap
Gets a map of id to tag that this manager knows about.- Returns:
- a map of id to tag.
-
exists
Checks if a tag with the given id exists and is registered.- Parameters:
id- The id of the tag to check.- Returns:
- true if it exists, false otherwise.
- DocParam:
- id "minecraft:wool"
-
exists
default boolean exists(net.minecraft.resources.ResourceLocation id) Checks if a tag with the given id exists and is registered.- Parameters:
id- The id of the tag to check.- Returns:
- true if it exists, false otherwise.
- DocParam:
- id invalid input: '<'resource:minecraft:wool>
-
exists
Checks if the given tag exists and is registered.- Parameters:
tag- The tag to check.- Returns:
- true if it exists, false otherwise.
- DocParam:
- tag invalid input: '<'tag:item:minecraft:wool>
-
tagKeys
List<net.minecraft.resources.ResourceLocation> tagKeys()Gets the keys of the tags that this manager knows about.- Returns:
- A List of keys of the tags that this manager knows about.
-
getCommandString
Gets the command string of this manager.- Specified by:
getCommandStringin interfaceCommandStringDisplayable- Returns:
- The command string of this manager.
-
addTag
<U> void addTag(net.minecraft.resources.ResourceLocation id, Collection<net.minecraft.core.Holder<U>> tag) Adds a tag to this manager with the given id.- Parameters:
id- The id of the tag to add.tag- The tag to add
-
internalTags
Map<net.minecraft.resources.ResourceLocation,Collection<net.minecraft.core.Holder<?>>> internalTags()Gets the internal tags of this manager.- Returns:
- a map of id to tag.
-
bind
void bind(net.minecraft.tags.TagManager.LoadResult<?> result) Binds this manager to the given load result.This is usually storing the given
TagManager.LoadResultinto aMutableLoadResultwhich allows for easy mutation.- Parameters:
result- The result to bind to.
-
elementClass
Gets the element type that this tag manager handles.This is only used to fill in type parameters, if your custom ITagManager does not have a type paremeter, you can return an empty optional.
- Returns:
- An optional class of the type of elements that this manager deals with.
-
addId
Adds the elements that correspond to the givenResourceLocationto the given tag.- Parameters:
to- The tag to add to.values- The registry key of the elements to add.- DocParam:
- to invalid input: '<'tag:item:minecraft:wool>, values invalid input: '<'resource:minecraft:diamond>
-
removeId
Removes the elements that correspond to the givenResourceLocationfrom the given tag.- Parameters:
from- The tag to remove from.values- The registry key of the elements to remove.- DocParam:
- from invalid input: '<'tag:item:minecraft:wool>, values invalid input: '<'resource:minecraft:diamond>
-
clear
Clears all values of the given tag.- Parameters:
from- The tag to clear.- DocParam:
- from invalid input: '<'tag:item:minecraft:wool>
-
idElements
Gets theResourceLocationids of the elements in the given tag.- Parameters:
of- The tag to get the elements of.- Returns:
- A List of
ResourceLocationids of the elements in the given tag. - DocParam:
- of invalid input: '<'tag:item:minecraft:wool>
-
getInternalRaw
Gets the internalCollectioninvalid input: '<'Holder> of the given tag.This method should only be used when you do not have access to the more specific version of this method in
KnownTagManager- Parameters:
tag- The tag to get the internal value of.- Returns:
- The internal
Collectioninvalid input: '<'Holder> of the given tag.
-
tags
Ges the tags that this manager knows about.- Returns:
- The tags that this manager knows about.
-
getTagsFor
Ges the tags that contain the given element.- Returns:
- The tags that contain the given elements.
-
resourceKey
net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>> resourceKey()Gets the resource key of the registry that this manager deals with.- Returns:
- The resource key of the registry that this manager deals with.
-
recalculate
void recalculate()Recalculates the cached tag map. -
tag
Gets a tag from the givenTagKey.- Parameters:
key- The key to get the tag of.- Returns:
- a new tag from the given
TagKey.
-
iterator
-
compareTo
- Specified by:
compareToin interfaceComparable<T extends MCTag>
-