Record Class PlayerHurtEntityTrigger.TriggerInstance
java.lang.Object
java.lang.Record
net.minecraft.advancements.critereon.PlayerHurtEntityTrigger.TriggerInstance
- All Implemented Interfaces:
SimpleCriterionTrigger.SimpleInstance
,CriterionTriggerInstance
- Enclosing class:
- PlayerHurtEntityTrigger
public static record PlayerHurtEntityTrigger.TriggerInstance(Optional<ContextAwarePredicate> player, Optional<DamagePredicate> damage, Optional<ContextAwarePredicate> entity)
extends Record
implements SimpleCriterionTrigger.SimpleInstance
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<PlayerHurtEntityTrigger.TriggerInstance>
private final Optional<DamagePredicate>
The field for thedamage
record component.private final Optional<ContextAwarePredicate>
The field for theentity
record component.private final Optional<ContextAwarePredicate>
The field for theplayer
record component. -
Constructor Summary
ConstructorDescriptionTriggerInstance
(Optional<ContextAwarePredicate> player, Optional<DamagePredicate> damage, Optional<ContextAwarePredicate> entity) Creates an instance of aTriggerInstance
record class. -
Method Summary
Modifier and TypeMethodDescriptiondamage()
Returns the value of thedamage
record component.entity()
Returns the value of theentity
record component.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
(ServerPlayer p_60143_, LootContext p_60144_, DamageSource p_60145_, float p_60146_, float p_60147_, boolean p_60148_) player()
Returns the value of theplayer
record component.playerHurtEntity
(Optional<DamagePredicate> p_299532_, Optional<EntityPredicate> p_298332_) playerHurtEntity
(Optional<EntityPredicate> p_297304_) playerHurtEntity
(DamagePredicate.Builder p_300965_, Optional<EntityPredicate> p_298699_) playerHurtEntityWithDamage
(Optional<DamagePredicate> p_297888_) final String
toString()
Returns a string representation of this record class.void
validate
(CriterionValidator p_311209_)
-
Field Details
-
player
The field for theplayer
record component. -
damage
The field for thedamage
record component. -
entity
The field for theentity
record component. -
CODEC
-
-
Constructor Details
-
TriggerInstance
public TriggerInstance(Optional<ContextAwarePredicate> player, Optional<DamagePredicate> damage, Optional<ContextAwarePredicate> entity) Creates an instance of aTriggerInstance
record class.- Parameters:
player
- the value for theplayer
record componentdamage
- the value for thedamage
record componententity
- the value for theentity
record component
-
-
Method Details
-
playerHurtEntity
-
playerHurtEntityWithDamage
public static Criterion<PlayerHurtEntityTrigger.TriggerInstance> playerHurtEntityWithDamage(Optional<DamagePredicate> p_297888_) -
playerHurtEntityWithDamage
public static Criterion<PlayerHurtEntityTrigger.TriggerInstance> playerHurtEntityWithDamage(DamagePredicate.Builder p_297478_) -
playerHurtEntity
public static Criterion<PlayerHurtEntityTrigger.TriggerInstance> playerHurtEntity(Optional<EntityPredicate> p_297304_) -
playerHurtEntity
public static Criterion<PlayerHurtEntityTrigger.TriggerInstance> playerHurtEntity(Optional<DamagePredicate> p_299532_, Optional<EntityPredicate> p_298332_) -
playerHurtEntity
public static Criterion<PlayerHurtEntityTrigger.TriggerInstance> playerHurtEntity(DamagePredicate.Builder p_300965_, Optional<EntityPredicate> p_298699_) -
matches
public boolean matches(ServerPlayer p_60143_, LootContext p_60144_, DamageSource p_60145_, float p_60146_, float p_60147_, boolean p_60148_) -
validate
- Specified by:
validate
in interfaceCriterionTriggerInstance
- Specified by:
validate
in interfaceSimpleCriterionTrigger.SimpleInstance
-
player
Returns the value of theplayer
record component.- Specified by:
player
in interfaceSimpleCriterionTrigger.SimpleInstance
- Returns:
- the value of the
player
record component
-
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)
. -
damage
Returns the value of thedamage
record component.- Returns:
- the value of the
damage
record component
-
entity
Returns the value of theentity
record component.- Returns:
- the value of the
entity
record component
-