Record Class DamageEventPacket

java.lang.Object
java.lang.Record
net.minestom.server.network.packet.server.play.DamageEventPacket
Record Components:
targetEntityId - ID of the entity being damaged
damageType - the damage type
sourceEntityId - the ID of the entity responsible for the damage, or null when there is none
sourceDirectId - the ID of the entity that directly dealt the damage, such as a projectile, or null when there is none. For a melee hit this is the same as sourceEntityId
sourcePos - null if there is no source position, otherwise the position of the source
All Implemented Interfaces:
Packet, SendablePacket, ServerPacket, ServerPacket.Play

public record DamageEventPacket(int targetEntityId, RegistryKey<DamageType> damageType, @Nullable Integer sourceEntityId, @Nullable Integer sourceDirectId, @Nullable Point sourcePos) extends Record implements ServerPacket.Play
See the Minecraft wiki for more info.
  • Field Details

  • Constructor Details

  • 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.
    • targetEntityId

      public int targetEntityId()
      Returns the value of the targetEntityId record component.
      Returns:
      the value of the targetEntityId record component
    • damageType

      public RegistryKey<DamageType> damageType()
      Returns the value of the damageType record component.
      Returns:
      the value of the damageType record component
    • sourceEntityId

      @Nullable public @Nullable Integer sourceEntityId()
      Returns the value of the sourceEntityId record component.
      Returns:
      the value of the sourceEntityId record component
    • sourceDirectId

      @Nullable public @Nullable Integer sourceDirectId()
      Returns the value of the sourceDirectId record component.
      Returns:
      the value of the sourceDirectId record component
    • sourcePos

      @Nullable public @Nullable Point sourcePos()
      Returns the value of the sourcePos record component.
      Returns:
      the value of the sourcePos record component