Record Class DamagePredicate
java.lang.Object
java.lang.Record
net.minecraft.core.component.predicates.DamagePredicate
- All Implemented Interfaces:
DataComponentPredicate
public record DamagePredicate(MinMaxBounds.Ints durability, MinMaxBounds.Ints damage)
extends Record
implements DataComponentPredicate
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.core.component.predicates.DataComponentPredicate
DataComponentPredicate.Single<T extends DataComponentPredicate>, DataComponentPredicate.Type<T extends DataComponentPredicate> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<DamagePredicate> private final MinMaxBounds.IntsThe field for thedamagerecord component.private final MinMaxBounds.IntsThe field for thedurabilityrecord component.Fields inherited from interface net.minecraft.core.component.predicates.DataComponentPredicate
SINGLE_STREAM_CODEC, STREAM_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionDamagePredicate(MinMaxBounds.Ints durability, MinMaxBounds.Ints damage) Creates an instance of aDamagePredicaterecord class. -
Method Summary
Modifier and TypeMethodDescriptiondamage()Returns the value of thedamagerecord component.Returns the value of thedurabilityrecord component.static DamagePredicatedurability(MinMaxBounds.Ints pDurability) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanmatches(DataComponentGetter p_399972_) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
durability
The field for thedurabilityrecord component. -
damage
The field for thedamagerecord component. -
CODEC
-
-
Constructor Details
-
DamagePredicate
Creates an instance of aDamagePredicaterecord class.- Parameters:
durability- the value for thedurabilityrecord componentdamage- the value for thedamagerecord component
-
-
Method Details
-
matches
- Specified by:
matchesin interfaceDataComponentPredicate
-
durability
-
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). -
durability
Returns the value of thedurabilityrecord component.- Returns:
- the value of the
durabilityrecord component
-
damage
Returns the value of thedamagerecord component.- Returns:
- the value of the
damagerecord component
-