java.lang.Object
java.lang.Record
top.offsetmonkey538.loottablemodifier.common.api.resource.predicate.table.TablePredicate
Record Components:
identifiers - the identifiers to match. List entries are in an OR relationship
types - the types to match. List entries are in an OR relationship
All Implemented Interfaces:
Predicate<LootModifierContext>, LootModifierPredicate

public record TablePredicate(@Nullable List<RegexPattern> identifiers, @Nullable List<RegexPattern> types) extends Record implements LootModifierPredicate
Matches loot tables based on the identifier and type patterns
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<TablePredicate> CODEC
  • Constructor Details

    • TablePredicate

      public TablePredicate(@Nullable @Nullable List<RegexPattern> identifiers, @Nullable @Nullable List<RegexPattern> types)
      Creates an instance of a TablePredicate record class.
      Parameters:
      identifiers - the value for the identifiers record component
      types - the value for the types record component
  • Method Details

    • getType

      public LootModifierPredicateType getType()
      Description copied from interface: LootModifierPredicate
      Returns the type of this action.
      Specified by:
      getType in interface LootModifierPredicate
      Returns:
      the type of this action.
    • test

      public boolean test(@NotNull @NotNull LootModifierContext context)
      Description copied from interface: LootModifierPredicate
      Tests this predicate against the provided context.
      Specified by:
      test in interface LootModifierPredicate
      Specified by:
      test in interface Predicate<LootModifierContext>
      Parameters:
      context - the context to match against
      Returns:
      if this predicate matched the provided context
    • builder

      @Contract("->new") public static TablePredicate.Builder builder()
      Creates a builder for TablePredicate
      Returns:
      a new TablePredicate.Builder
    • 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.
    • identifiers

      @Nullable public @Nullable List<RegexPattern> identifiers()
      Returns the value of the identifiers record component.
      Returns:
      the value of the identifiers record component
    • types

      @Nullable public @Nullable List<RegexPattern> types()
      Returns the value of the types record component.
      Returns:
      the value of the types record component