Record Class TagPredicate<T>

java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.TagPredicate<T>

public record TagPredicate<T>(TagKey<T> tag, boolean expected) extends Record
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final boolean
    The field for the expected record component.
    private final TagKey<T>
    The field for the tag record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TagPredicate(TagKey<T> tag, boolean expected)
    Creates an instance of a TagPredicate record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> com.mojang.serialization.Codec<TagPredicate<T>>
    codec(ResourceKey<? extends Registry<T>> p_298649_)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    boolean
    Returns the value of the expected record component.
    final int
    Returns a hash code value for this object.
    static <T> TagPredicate<T>
    is(TagKey<T> p_270668_)
     
    static <T> TagPredicate<T>
    isNot(TagKey<T> p_270264_)
     
    boolean
    matches(Holder<T> p_270125_)
     
    tag()
    Returns the value of the tag record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • tag

      private final TagKey<T> tag
      The field for the tag record component.
    • expected

      private final boolean expected
      The field for the expected record component.
  • Constructor Details

    • TagPredicate

      public TagPredicate(TagKey<T> tag, boolean expected)
      Creates an instance of a TagPredicate record class.
      Parameters:
      tag - the value for the tag record component
      expected - the value for the expected record component
  • Method Details

    • codec

      public static <T> com.mojang.serialization.Codec<TagPredicate<T>> codec(ResourceKey<? extends Registry<T>> p_298649_)
    • is

      public static <T> TagPredicate<T> is(TagKey<T> p_270668_)
    • isNot

      public static <T> TagPredicate<T> isNot(TagKey<T> p_270264_)
    • matches

      public boolean matches(Holder<T> p_270125_)
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • tag

      public TagKey<T> tag()
      Returns the value of the tag record component.
      Returns:
      the value of the tag record component
    • expected

      public boolean expected()
      Returns the value of the expected record component.
      Returns:
      the value of the expected record component