Interface ITagManager<T extends MCTag>

All Superinterfaces:
CommandStringDisplayable, Iterable<T>
All Known Implementing Classes:
EntityTypeTagManager, KnownTagManager, UnknownTagManager

@ZenRegister(loaders={"crafttweaker","tags"}) public interface ITagManager<T extends MCTag> extends CommandStringDisplayable, Iterable<T>
DocParam:
this <tagmanager:items>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addId(T to, net.minecraft.resources.ResourceLocation... values)
    Adds the elements that correspond to the given ResourceLocation to the given tag.
    <U> void
    addTag(net.minecraft.resources.ResourceLocation id, net.minecraft.tags.Tag<net.minecraft.core.Holder<U>> tag)
    Adds a tag to this manager with the given id.
    void
    bind(net.minecraft.tags.TagManager.LoadResult<?> result)
    Binds this manager to the given load result.
    void
    clear(T from)
    Clears all values of the given tag.
    default Optional<Class<?>>
    Gets the element type that this tag manager handles.
    default boolean
    Checks if a tag with the given id exists and is registered.
    default boolean
    exists(net.minecraft.resources.ResourceLocation id)
    Checks if a tag with the given id exists and is registered.
    default boolean
    exists(T tag)
    Checks if the given tag exists and is registered.
    default String
    Gets the command string of this manager.
    net.minecraft.tags.Tag<net.minecraft.core.Holder<?>>
    Gets the internal Tag<Holder> of the given tag.
    default List<T>
    getTagsFor(net.minecraft.resources.ResourceLocation element)
    Ges the tags that contain the given element.
    default List<net.minecraft.resources.ResourceLocation>
    Gets the ResourceLocation ids of the elements in the given tag.
    Map<net.minecraft.resources.ResourceLocation,net.minecraft.tags.Tag<net.minecraft.core.Holder<?>>>
    Gets the internal tags of this manager.
    default Iterator<T>
     
    void
    Recalculates the cached tag map.
    void
    removeId(T from, net.minecraft.resources.ResourceLocation... values)
    Removes the elements that correspond to the given ResourceLocation from the given tag.
    net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<?>>
    Gets the resource key of the registry that this manager deals with.
    tag(String id)
    Gets a tag with the given id.
    tag(net.minecraft.resources.ResourceLocation id)
    Gets a tag with the given id.
    default T
    tag(net.minecraft.tags.TagKey<?> key)
    Gets a tag from the given TagKey.
    default String
    Gets the tagFolder of this manager.
    List<net.minecraft.resources.ResourceLocation>
    Gets the keys of the tags that this manager knows about.
    Map<net.minecraft.resources.ResourceLocation,T>
    Gets a map of id to tag that this manager knows about.
    default List<T>
    Ges the tags that this manager knows about.

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Method Details

    • tagFolder

      default String 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

      T tag(String id)
      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

      T tag(net.minecraft.resources.ResourceLocation id)
      Gets a tag with the given id.
      Parameters:
      id - The id of the tag.
      Returns:
      A tag with the given id.
      DocParam:
      id <resource:minecraft:wool>
    • tagMap

      Map<net.minecraft.resources.ResourceLocation,T> tagMap()
      Gets a map of id to tag that this manager knows about.
      Returns:
      a map of id to tag.
    • exists

      default boolean exists(String 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 "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 <resource:minecraft:wool>
    • exists

      default boolean exists(T tag)
      Checks if the given tag exists and is registered.
      Parameters:
      tag - The tag to check.
      Returns:
      true if it exists, false otherwise.
      DocParam:
      tag <tag:items: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

      default String getCommandString()
      Gets the command string of this manager.
      Specified by:
      getCommandString in interface CommandStringDisplayable
      Returns:
      The command string of this manager.
    • addTag

      <U> void addTag(net.minecraft.resources.ResourceLocation id, net.minecraft.tags.Tag<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,net.minecraft.tags.Tag<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.LoadResult into a MutableLoadResult which allows for easy mutation.

      Parameters:
      result - The result to bind to.
    • elementClass

      default Optional<Class<?>> 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

      void addId(T to, net.minecraft.resources.ResourceLocation... values)
      Adds the elements that correspond to the given ResourceLocation to the given tag.
      Parameters:
      to - The tag to add to.
      values - The registry key of the elements to add.
      DocParam:
      to <tag:items:minecraft:wool>, values <resource:minecraft:diamond>
    • removeId

      void removeId(T from, net.minecraft.resources.ResourceLocation... values)
      Removes the elements that correspond to the given ResourceLocation from the given tag.
      Parameters:
      from - The tag to remove from.
      values - The registry key of the elements to remove.
      DocParam:
      from <tag:items:minecraft:wool>, values <resource:minecraft:diamond>
    • clear

      void clear(T from)
      Clears all values of the given tag.
      Parameters:
      from - The tag to clear.
      DocParam:
      from <tag:items:minecraft:wool>
    • idElements

      default List<net.minecraft.resources.ResourceLocation> idElements(T of)
      Gets the ResourceLocation ids of the elements in the given tag.
      Parameters:
      of - The tag to get the elements of.
      Returns:
      A List of ResourceLocation ids of the elements in the given tag.
      DocParam:
      of <tag:items:minecraft:wool>
    • getInternalRaw

      @Nullable net.minecraft.tags.Tag<net.minecraft.core.Holder<?>> getInternalRaw(T tag)
      Gets the internal Tag<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 Tag<Holder> of the given tag.
    • tags

      default List<T> tags()
      Ges the tags that this manager knows about.
      Returns:
      The tags that this manager knows about.
    • getTagsFor

      default List<T> getTagsFor(net.minecraft.resources.ResourceLocation element)
      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

      default T tag(net.minecraft.tags.TagKey<?> key)
      Gets a tag from the given TagKey.
      Parameters:
      key - The key to get the tag of.
      Returns:
      a new tag from the given TagKey.
    • iterator

      @Nonnull default Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T extends MCTag>