Record Class DataComponentMatchers
java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.DataComponentMatchers
- All Implemented Interfaces:
Predicate<DataComponentGetter>
public record DataComponentMatchers(DataComponentExactPredicate exact, Map<DataComponentPredicate.Type<?>,DataComponentPredicate> partial)
extends Record
implements Predicate<DataComponentGetter>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DataComponentMatchersstatic final com.mojang.serialization.MapCodec<DataComponentMatchers> private final DataComponentExactPredicateThe field for theexactrecord component.private final Map<DataComponentPredicate.Type<?>, DataComponentPredicate> The field for thepartialrecord component.static final StreamCodec<RegistryFriendlyByteBuf, DataComponentMatchers> -
Constructor Summary
ConstructorsConstructorDescriptionDataComponentMatchers(DataComponentExactPredicate exact, Map<DataComponentPredicate.Type<?>, DataComponentPredicate> partial) Creates an instance of aDataComponentMatchersrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.exact()Returns the value of theexactrecord component.final inthashCode()Returns a hash code value for this object.booleanisEmpty()partial()Returns the value of thepartialrecord component.booleantest(DataComponentGetter pComponentGetter) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
exact
The field for theexactrecord component. -
partial
The field for thepartialrecord component. -
ANY
-
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
DataComponentMatchers
public DataComponentMatchers(DataComponentExactPredicate exact, Map<DataComponentPredicate.Type<?>, DataComponentPredicate> partial) Creates an instance of aDataComponentMatchersrecord class.- Parameters:
exact- the value for theexactrecord componentpartial- the value for thepartialrecord component
-
-
Method Details
-
test
- Specified by:
testin interfacePredicate<DataComponentGetter>
-
isEmpty
public boolean isEmpty() -
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
exact
Returns the value of theexactrecord component.- Returns:
- the value of the
exactrecord component
-
partial
Returns the value of thepartialrecord component.- Returns:
- the value of the
partialrecord component
-