Record Class ClientboundDamageEventPacket

java.lang.Object
java.lang.Record
net.minecraft.network.protocol.game.ClientboundDamageEventPacket
All Implemented Interfaces:
Packet<ClientGamePacketListener>

public record ClientboundDamageEventPacket(int entityId, int sourceTypeId, int sourceCauseId, int sourceDirectId, Optional<Vec3> sourcePosition) extends Record implements Packet<ClientGamePacketListener>
  • Field Details

    • entityId

      private final int entityId
      The field for the entityId record component.
    • sourceTypeId

      private final int sourceTypeId
      The field for the sourceTypeId record component.
    • sourceCauseId

      private final int sourceCauseId
      The field for the sourceCauseId record component.
    • sourceDirectId

      private final int sourceDirectId
      The field for the sourceDirectId record component.
    • sourcePosition

      private final Optional<Vec3> sourcePosition
      The field for the sourcePosition record component.
  • Constructor Details

    • ClientboundDamageEventPacket

      public ClientboundDamageEventPacket(Entity p_270474_, DamageSource p_270781_)
    • ClientboundDamageEventPacket

      public ClientboundDamageEventPacket(FriendlyByteBuf p_270722_)
    • ClientboundDamageEventPacket

      public ClientboundDamageEventPacket(int entityId, int sourceTypeId, int sourceCauseId, int sourceDirectId, Optional<Vec3> sourcePosition)
      Creates an instance of a ClientboundDamageEventPacket record class.
      Parameters:
      entityId - the value for the entityId record component
      sourceTypeId - the value for the sourceTypeId record component
      sourceCauseId - the value for the sourceCauseId record component
      sourceDirectId - the value for the sourceDirectId record component
      sourcePosition - the value for the sourcePosition record component
  • Method Details

    • writeOptionalEntityId

      private static void writeOptionalEntityId(FriendlyByteBuf p_270812_, int p_270852_)
    • readOptionalEntityId

      private static int readOptionalEntityId(FriendlyByteBuf p_270462_)
    • write

      public void write(FriendlyByteBuf p_270971_)
      Specified by:
      write in interface Packet<ClientGamePacketListener>
    • handle

      public void handle(ClientGamePacketListener p_270510_)
      Specified by:
      handle in interface Packet<ClientGamePacketListener>
    • getSource

      public DamageSource getSource(Level p_270943_)
    • 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.
    • entityId

      public int entityId()
      Returns the value of the entityId record component.
      Returns:
      the value of the entityId record component
    • sourceTypeId

      public int sourceTypeId()
      Returns the value of the sourceTypeId record component.
      Returns:
      the value of the sourceTypeId record component
    • sourceCauseId

      public int sourceCauseId()
      Returns the value of the sourceCauseId record component.
      Returns:
      the value of the sourceCauseId record component
    • sourceDirectId

      public int sourceDirectId()
      Returns the value of the sourceDirectId record component.
      Returns:
      the value of the sourceDirectId record component
    • sourcePosition

      public Optional<Vec3> sourcePosition()
      Returns the value of the sourcePosition record component.
      Returns:
      the value of the sourcePosition record component