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.Ints
The field for thedamage
record component.private final MinMaxBounds.Ints
The field for thedurability
record 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 aDamagePredicate
record class. -
Method Summary
Modifier and TypeMethodDescriptiondamage()
Returns the value of thedamage
record component.Returns the value of thedurability
record component.static DamagePredicate
durability
(MinMaxBounds.Ints p_400235_) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
matches
(DataComponentGetter p_399972_) final String
toString()
Returns a string representation of this record class.
-
Field Details
-
durability
The field for thedurability
record component. -
damage
The field for thedamage
record component. -
CODEC
-
-
Constructor Details
-
DamagePredicate
Creates an instance of aDamagePredicate
record class.- Parameters:
durability
- the value for thedurability
record componentdamage
- the value for thedamage
record component
-
-
Method Details
-
matches
- Specified by:
matches
in 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 thedurability
record component.- Returns:
- the value of the
durability
record component
-
damage
Returns the value of thedamage
record component.- Returns:
- the value of the
damage
record component
-