Record Class ModuleContentKind

java.lang.Object
java.lang.Record
com.ultikits.ultitools.utils.ModuleContentKind
Record Components:
kind - the kind, matching PATTERN, for example ENCHANTMENT
count - how many entries of this kind, or null when unknown; at most MAX_COUNT

@Internal public record ModuleContentKind(String kind, @Nullable Integer count) extends Record
One kind of custom game content a module added, with how many entries of it when known.

Kinds are open lower-case identifiers so that later releases can add kinds without breaking readers: code that meets a kind it does not know shows it with generic wording.

Since:
7.0.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final @Nullable Integer
    The field for the count record component.
    static final String
    Bundled data packs; removing them removes their recipes and advancements.
    static final String
    Custom enchantments; removing them strips them from items for good.
    private final String
    The field for the kind record component.
    static final int
    The largest count a kind carries; larger counts are capped to it.
    static final Pattern
    The shape every kind must have.
    static final String
    Tag additions or new tags; removing them only makes those item categories stop applying.
    static final String
    The record could not be read, so the module may have added custom content.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModuleContentKind(String kind, @Nullable Integer count)
    Validates the kind and count, capping large counts and clearing the count for UNKNOWN.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Integer
    Returns the value of the count record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the kind record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • kind

      private final String kind
      The field for the kind record component.
    • count

      @Nullable private final @Nullable Integer count
      The field for the count record component.
    • ENCHANTMENT

      public static final String ENCHANTMENT
      Custom enchantments; removing them strips them from items for good.
      See Also:
    • DATAPACK

      public static final String DATAPACK
      Bundled data packs; removing them removes their recipes and advancements.
      See Also:
    • TAG

      public static final String TAG
      Tag additions or new tags; removing them only makes those item categories stop applying.
      See Also:
    • UNKNOWN

      public static final String UNKNOWN
      The record could not be read, so the module may have added custom content.
      See Also:
    • PATTERN

      public static final Pattern PATTERN
      The shape every kind must have.
    • MAX_COUNT

      public static final int MAX_COUNT
      The largest count a kind carries; larger counts are capped to it.
      See Also:
  • Constructor Details

    • ModuleContentKind

      public ModuleContentKind(String kind, @Nullable @Nullable Integer count)
      Validates the kind and count, capping large counts and clearing the count for UNKNOWN.
      Parameters:
      kind - the open lower-case kind identifier
      count - the entry count, or null when unknown
      Throws:
      NullPointerException - if kind is null
      IllegalArgumentException - if the kind is invalid or the count is less than one
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • kind

      public String kind()
      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • count

      @Nullable public @Nullable Integer count()
      Returns the value of the count record component.
      Returns:
      the value of the count record component