Record Class DamagePredicate
java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.DamagePredicate
public record DamagePredicate(MinMaxBounds.Doubles dealtDamage, MinMaxBounds.Doubles takenDamage, Optional<EntityPredicate> sourceEntity, Optional<Boolean> blocked, Optional<DamageSourcePredicate> type)
extends Record
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionThe field for theblockedrecord component.static final com.mojang.serialization.Codec<DamagePredicate> private final MinMaxBounds.DoublesThe field for thedealtDamagerecord component.private final Optional<EntityPredicate> The field for thesourceEntityrecord component.private final MinMaxBounds.DoublesThe field for thetakenDamagerecord component.private final Optional<DamageSourcePredicate> The field for thetyperecord component. -
Constructor Summary
ConstructorsConstructorDescriptionDamagePredicate(MinMaxBounds.Doubles dealtDamage, MinMaxBounds.Doubles takenDamage, Optional<EntityPredicate> sourceEntity, Optional<Boolean> blocked, Optional<DamageSourcePredicate> type) Creates an instance of aDamagePredicaterecord class. -
Method Summary
Modifier and TypeMethodDescriptionblocked()Returns the value of theblockedrecord component.Returns the value of thedealtDamagerecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanmatches(ServerPlayer p_24918_, DamageSource p_24919_, float p_24920_, float p_24921_, boolean p_24922_) Returns the value of thesourceEntityrecord component.Returns the value of thetakenDamagerecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Field Details
-
dealtDamage
The field for thedealtDamagerecord component. -
takenDamage
The field for thetakenDamagerecord component. -
sourceEntity
The field for thesourceEntityrecord component. -
blocked
The field for theblockedrecord component. -
type
The field for thetyperecord component. -
CODEC
-
-
Constructor Details
-
DamagePredicate
public DamagePredicate(MinMaxBounds.Doubles dealtDamage, MinMaxBounds.Doubles takenDamage, Optional<EntityPredicate> sourceEntity, Optional<Boolean> blocked, Optional<DamageSourcePredicate> type) Creates an instance of aDamagePredicaterecord class.- Parameters:
dealtDamage- the value for thedealtDamagerecord componenttakenDamage- the value for thetakenDamagerecord componentsourceEntity- the value for thesourceEntityrecord componentblocked- the value for theblockedrecord componenttype- the value for thetyperecord component
-
-
Method Details
-
matches
public boolean matches(ServerPlayer p_24918_, DamageSource p_24919_, float p_24920_, float p_24921_, boolean p_24922_) -
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). -
dealtDamage
Returns the value of thedealtDamagerecord component.- Returns:
- the value of the
dealtDamagerecord component
-
takenDamage
Returns the value of thetakenDamagerecord component.- Returns:
- the value of the
takenDamagerecord component
-
sourceEntity
Returns the value of thesourceEntityrecord component.- Returns:
- the value of the
sourceEntityrecord component
-
blocked
Returns the value of theblockedrecord component.- Returns:
- the value of the
blockedrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-