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 Summary

    Fields
    Modifier and Type
    Field
    Description
    private final float
    The field for the damage record component.
    private final float
    The field for the fallDistance record component.
    private final FallLocation
    The field for the fallLocation record component.
    private final DamageSource
    The field for the source record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CombatEntry(DamageSource source, float damage, FallLocation fallLocation, float fallDistance)
    Creates an instance of a CombatEntry record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Returns the value of the damage record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    float
    Returns the value of the fallDistance record component.
    Returns the value of the fallLocation record component.
    final int
    Returns a hash code value for this object.
    Returns the value of the source record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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

      @Nullable private final 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 '=='.
      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

      @Nullable public 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