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, Holder<DamageType> sourceType, 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.
    • sourceType

      private final Holder<DamageType> sourceType
      The field for the sourceType 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.
    • STREAM_CODEC

  • Constructor Details

    • ClientboundDamageEventPacket

      public ClientboundDamageEventPacket(Entity p_270474_, DamageSource p_270781_)
    • ClientboundDamageEventPacket

      private ClientboundDamageEventPacket(RegistryFriendlyByteBuf p_321729_)
    • ClientboundDamageEventPacket

      public ClientboundDamageEventPacket(int entityId, Holder<DamageType> sourceType, int sourceCauseId, int sourceDirectId, Optional<Vec3> sourcePosition)
      Creates an instance of a ClientboundDamageEventPacket record class.
      Parameters:
      entityId - the value for the entityId record component
      sourceType - the value for the sourceType 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

      private void write(RegistryFriendlyByteBuf p_321775_)
    • type

      Specified by:
      type 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
    • sourceType

      public Holder<DamageType> sourceType()
      Returns the value of the sourceType record component.
      Returns:
      the value of the sourceType 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