Record Class CombatEntry

java.lang.Object
java.lang.Record
net.minecraft.world.damagesource.CombatEntry

public record CombatEntry(DamageSource source, float damage, @Nullable FallLocation fallLocation, float fallDistance) extends Record
  • Field Details

    • source

      private final DamageSource source
      The field for the source record component.
    • damage

      private final float damage
      The field for the damage record component.
    • fallLocation

      private final @Nullable FallLocation fallLocation
      The field for the fallLocation record component.
    • fallDistance

      private final float fallDistance
      The field for the fallDistance record component.
  • Constructor Details

    • CombatEntry

      public CombatEntry(DamageSource source, float damage, @Nullable FallLocation fallLocation, float fallDistance)
      Creates an instance of a CombatEntry record class.
      Parameters:
      source - the value for the source record component
      damage - the value for the damage record component
      fallLocation - the value for the fallLocation record component
      fallDistance - the value for the fallDistance record component
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • source

      public DamageSource source()
      Returns the value of the source record component.
      Returns:
      the value of the source record component
    • damage

      public float damage()
      Returns the value of the damage record component.
      Returns:
      the value of the damage record component
    • fallLocation

      public @Nullable FallLocation fallLocation()
      Returns the value of the fallLocation record component.
      Returns:
      the value of the fallLocation record component
    • fallDistance

      public float fallDistance()
      Returns the value of the fallDistance record component.
      Returns:
      the value of the fallDistance record component