Class KnownTag<T>

java.lang.Object
com.blamejared.crafttweaker.api.tag.type.KnownTag<T>
Type Parameters:
T - The type of element this tag holds.
All Implemented Interfaces:
CommandStringDisplayable, MCTag, Comparable<MCTag>, Iterable<T>

@ZenRegister public class KnownTag<T> extends Object implements MCTag, Iterable<T>
A known tag is a tag whose element is known and has been registered as Taggable.

Known tags let you use the actual element to interact with the tag instead of using the registry key of the element

  • Constructor Details

    • KnownTag

      public KnownTag(@Nonnull net.minecraft.resources.ResourceLocation id, @Nonnull KnownTagManager<T> manager)
  • Method Details

    • getInternal

      public <U extends Collection<net.minecraft.core.Holder<?>>> U getInternal()
      Description copied from interface: MCTag
      Gets the internal Collection of this tag.

      This should only be used if the values of the tag is needed, other usecases should use MCTag.getTagKey() instead.

      Specified by:
      getInternal in interface MCTag
      Returns:
      The internal Collection of this tag.
    • add

      @SafeVarargs public final void add(T... elements)
    • remove

      @SafeVarargs public final void remove(T... elements)
    • elements

      public List<T> elements()
    • contains

      public boolean contains(T element)
    • id

      public net.minecraft.resources.ResourceLocation id()
      Description copied from interface: MCTag
      Gets the id of this tag.
      Specified by:
      id in interface MCTag
      Returns:
      The id of this tag.
    • manager

      public KnownTagManager<T> manager()
      Description copied from interface: MCTag
      Gets the ITagManager for this tag.
      Specified by:
      manager in interface MCTag
      Returns:
      The ITagManager for this tag.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • iterator

      @Nonnull public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • withAmount

      public Many<KnownTag<T>> withAmount(int amount)
    • asTagWithAmount

      public Many<KnownTag<T>> asTagWithAmount()