Class Tag<T,D>

java.lang.Object
com.github.darksoulq.abyssallib.world.data.tag.Tag<T,D>
Type Parameters:
T - The type of entries stored within the tag.
D - The type of input used for testing membership in the tag.
Direct Known Subclasses:
BlockTag, ItemTag

public abstract class Tag<T,D> extends Object
An abstract representation of a data tag, which functions as a named collection of values.

Tags are used to group objects (like items or blocks) together under a single identifier, allowing for easier logic checks and data-driven configurations. Tags can also include other tags of the same type to form hierarchical relationships.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Tag(net.kyori.adventure.key.Key id)
    Constructs a new Tag instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(T value)
    Adds a direct entry to this tag.
    abstract boolean
    contains(D input)
    Checks if the given input is considered a member of this tag.
    abstract Set<T>
    Retrieves a flattened set of all entries in this tag and all inherited tags.
    net.kyori.adventure.key.Key
    Retrieves the unique identifier representing this tag.
    Retrieves the set of tags directly included by this tag.
    abstract TagType<T,D>
    Retrieves the specific type of this tag.
    Retrieves the local set of values directly assigned to this tag.
    void
    include(Tag<T,D> tag)
    Includes another tag's contents into this tag.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Tag

      public Tag(net.kyori.adventure.key.Key id)
      Constructs a new Tag instance.
      Parameters:
      id - The identifier for this tag.
  • Method Details

    • getType

      public abstract TagType<T,D> getType()
      Retrieves the specific type of this tag.
      Returns:
      The TagType defining this tag's logic and serialization.
    • add

      public void add(T value)
      Adds a direct entry to this tag.
      Parameters:
      value - The value of type T to add.
    • include

      public void include(Tag<T,D> tag)
      Includes another tag's contents into this tag.
      Parameters:
      tag - The Tag to include.
    • contains

      public abstract boolean contains(D input)
      Checks if the given input is considered a member of this tag.
      Parameters:
      input - The input of type D to test.
      Returns:
      true if the input matches any value in this tag or its included tags.
    • getAll

      public abstract Set<T> getAll()
      Retrieves a flattened set of all entries in this tag and all inherited tags.
      Returns:
      A Set containing all recursive entries of type T.
    • getValues

      public Set<T> getValues()
      Retrieves the local set of values directly assigned to this tag.
      Returns:
      A Set of directly added values.
    • getIncluded

      public Set<Tag<T,D>> getIncluded()
      Retrieves the set of tags directly included by this tag.
      Returns:
      A Set of included tags.
    • getId

      public net.kyori.adventure.key.Key getId()
      Retrieves the unique identifier representing this tag.
      Returns:
      The Key identifier.