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
  • Field Details

    • dealtDamage

      private final MinMaxBounds.Doubles dealtDamage
      The field for the dealtDamage record component.
    • takenDamage

      private final MinMaxBounds.Doubles takenDamage
      The field for the takenDamage record component.
    • sourceEntity

      private final Optional<EntityPredicate> sourceEntity
      The field for the sourceEntity record component.
    • blocked

      private final Optional<Boolean> blocked
      The field for the blocked record component.
    • type

      private final Optional<DamageSourcePredicate> type
      The field for the type record component.
    • CODEC

      public static final com.mojang.serialization.Codec<DamagePredicate> 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 a DamagePredicate record class.
      Parameters:
      dealtDamage - the value for the dealtDamage record component
      takenDamage - the value for the takenDamage record component
      sourceEntity - the value for the sourceEntity record component
      blocked - the value for the blocked record component
      type - the value for the type record component
  • Method Details

    • matches

      public boolean matches(ServerPlayer p_24918_, DamageSource p_24919_, float p_24920_, float p_24921_, boolean p_24922_)
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • dealtDamage

      public MinMaxBounds.Doubles dealtDamage()
      Returns the value of the dealtDamage record component.
      Returns:
      the value of the dealtDamage record component
    • takenDamage

      public MinMaxBounds.Doubles takenDamage()
      Returns the value of the takenDamage record component.
      Returns:
      the value of the takenDamage record component
    • sourceEntity

      public Optional<EntityPredicate> sourceEntity()
      Returns the value of the sourceEntity record component.
      Returns:
      the value of the sourceEntity record component
    • blocked

      public Optional<Boolean> blocked()
      Returns the value of the blocked record component.
      Returns:
      the value of the blocked record component
    • type

      Returns the value of the type record component.
      Returns:
      the value of the type record component