Record Class ClientboundServerDataPacket

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

public record ClientboundServerDataPacket(Component motd, Optional<byte[]> iconBytes) extends Record implements Packet<ClientGamePacketListener>
  • Field Details

    • motd

      private final Component motd
      The field for the motd record component.
    • iconBytes

      private final Optional<byte[]> iconBytes
      The field for the iconBytes record component.
    • STREAM_CODEC

      public static final StreamCodec<io.netty.buffer.ByteBuf,ClientboundServerDataPacket> STREAM_CODEC
  • Constructor Details

    • ClientboundServerDataPacket

      public ClientboundServerDataPacket(Component motd, Optional<byte[]> iconBytes)
      Creates an instance of a ClientboundServerDataPacket record class.
      Parameters:
      motd - the value for the motd record component
      iconBytes - the value for the iconBytes record component
  • Method Details

    • type

      Specified by:
      type in interface Packet<ClientGamePacketListener>
    • handle

      public void handle(ClientGamePacketListener p_237809_)
      Specified by:
      handle in interface Packet<ClientGamePacketListener>
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • motd

      public Component motd()
      Returns the value of the motd record component.
      Returns:
      the value of the motd record component
    • iconBytes

      public Optional<byte[]> iconBytes()
      Returns the value of the iconBytes record component.
      Returns:
      the value of the iconBytes record component