Record Class DamageSourcePredicate
java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.DamageSourcePredicate
public record DamageSourcePredicate(List<TagPredicate<DamageType>> tags, Optional<EntityPredicate> directEntity, Optional<EntityPredicate> sourceEntity)
extends Record
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<DamageSourcePredicate>
private final Optional<EntityPredicate>
The field for thedirectEntity
record component.private final Optional<EntityPredicate>
The field for thesourceEntity
record component.private final List<TagPredicate<DamageType>>
The field for thetags
record component. -
Constructor Summary
ConstructorDescriptionDamageSourcePredicate
(List<TagPredicate<DamageType>> tags, Optional<EntityPredicate> directEntity, Optional<EntityPredicate> sourceEntity) Creates an instance of aDamageSourcePredicate
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedirectEntity
record component.final boolean
Indicates whether some other object is "equal to" this one.static Optional<DamageSourcePredicate>
fromJson
(com.google.gson.JsonElement p_25452_) final int
hashCode()
Returns a hash code value for this object.boolean
matches
(ServerLevel p_25445_, Vec3 p_25446_, DamageSource p_25447_) boolean
matches
(ServerPlayer p_25449_, DamageSource p_25450_) com.google.gson.JsonElement
Returns the value of thesourceEntity
record component.tags()
Returns the value of thetags
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
tags
The field for thetags
record component. -
directEntity
The field for thedirectEntity
record component. -
sourceEntity
The field for thesourceEntity
record component. -
CODEC
-
-
Constructor Details
-
DamageSourcePredicate
public DamageSourcePredicate(List<TagPredicate<DamageType>> tags, Optional<EntityPredicate> directEntity, Optional<EntityPredicate> sourceEntity) Creates an instance of aDamageSourcePredicate
record class.- Parameters:
tags
- the value for thetags
record componentdirectEntity
- the value for thedirectEntity
record componentsourceEntity
- the value for thesourceEntity
record component
-
-
Method Details
-
matches
-
matches
-
fromJson
public static Optional<DamageSourcePredicate> fromJson(@Nullable com.google.gson.JsonElement p_25452_) -
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)
. -
tags
Returns the value of thetags
record component.- Returns:
- the value of the
tags
record component
-
directEntity
Returns the value of thedirectEntity
record component.- Returns:
- the value of the
directEntity
record component
-
sourceEntity
Returns the value of thesourceEntity
record component.- Returns:
- the value of the
sourceEntity
record component
-