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
-
Field Summary
Modifier and TypeFieldDescriptionThe field for theblocked
record component.private final MinMaxBounds.Doubles
The field for thedealtDamage
record component.private final Optional<EntityPredicate>
The field for thesourceEntity
record component.private final MinMaxBounds.Doubles
The field for thetakenDamage
record component.private final Optional<DamageSourcePredicate>
The field for thetype
record component. -
Constructor Summary
ConstructorDescriptionDamagePredicate
(MinMaxBounds.Doubles dealtDamage, MinMaxBounds.Doubles takenDamage, Optional<EntityPredicate> sourceEntity, Optional<Boolean> blocked, Optional<DamageSourcePredicate> type) Creates an instance of aDamagePredicate
record class. -
Method Summary
Modifier and TypeMethodDescriptionblocked()
Returns the value of theblocked
record component.Returns the value of thedealtDamage
record component.final boolean
Indicates whether some other object is "equal to" this one.static Optional<DamagePredicate>
fromJson
(com.google.gson.JsonElement p_24924_) final int
hashCode()
Returns a hash code value for this object.boolean
matches
(ServerPlayer p_24918_, DamageSource p_24919_, float p_24920_, float p_24921_, boolean p_24922_) com.google.gson.JsonElement
Returns the value of thesourceEntity
record component.Returns the value of thetakenDamage
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.
-
Field Details
-
dealtDamage
The field for thedealtDamage
record component. -
takenDamage
The field for thetakenDamage
record component. -
sourceEntity
The field for thesourceEntity
record component. -
blocked
The field for theblocked
record component. -
type
The field for thetype
record component.
-
-
Constructor Details
-
DamagePredicate
public DamagePredicate(MinMaxBounds.Doubles dealtDamage, MinMaxBounds.Doubles takenDamage, Optional<EntityPredicate> sourceEntity, Optional<Boolean> blocked, Optional<DamageSourcePredicate> type) Creates an instance of aDamagePredicate
record class.- Parameters:
dealtDamage
- the value for thedealtDamage
record componenttakenDamage
- the value for thetakenDamage
record componentsourceEntity
- the value for thesourceEntity
record componentblocked
- the value for theblocked
record componenttype
- the value for thetype
record component
-
-
Method Details
-
matches
public boolean matches(ServerPlayer p_24918_, DamageSource p_24919_, float p_24920_, float p_24921_, boolean p_24922_) -
fromJson
-
serializeToJson
public com.google.gson.JsonElement serializeToJson() -
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 thedealtDamage
record component.- Returns:
- the value of the
dealtDamage
record component
-
takenDamage
Returns the value of thetakenDamage
record component.- Returns:
- the value of the
takenDamage
record component
-
sourceEntity
Returns the value of thesourceEntity
record component.- Returns:
- the value of the
sourceEntity
record component
-
blocked
Returns the value of theblocked
record component.- Returns:
- the value of the
blocked
record component
-
type
Returns the value of thetype
record component.- Returns:
- the value of the
type
record component
-