Class ChatMessageC2SPacket

java.lang.Object
net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket
All Implemented Interfaces:
Packet<ServerPlayPacketListener>

public class ChatMessageC2SPacket extends Object implements Packet<ServerPlayPacketListener>
A packet used to send a chat message to the server.

This truncates the message to at most 256 characters before sending to the server on the client. If the server receives the message longer than 256 characters, it will reject the message and disconnect the client.

If the message contains an invalid character (see isValidChar), the server will reject the message and disconnect the client.

See Also:
Mappings:
Namespace Name
official vb
intermediary net/minecraft/class_2797
named net/minecraft/network/packet/c2s/play/ChatMessageC2SPacket
  • Field Details

    • MAX_LENGTH

      private static final int MAX_LENGTH
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lvb;a:I
      intermediary field_33359 Lnet/minecraft/class_2797;field_33359:I
      named MAX_LENGTH Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;MAX_LENGTH:I
    • chatMessage

      private final String chatMessage
      Mappings:
      Namespace Name Mixin selector
      official b Lvb;b:Ljava/lang/String;
      intermediary field_12764 Lnet/minecraft/class_2797;field_12764:Ljava/lang/String;
      named chatMessage Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;chatMessage:Ljava/lang/String;
  • Constructor Details

    • ChatMessageC2SPacket

      public ChatMessageC2SPacket(String chatMessage)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lvb;<init>(Ljava/lang/String;)V
      intermediary <init> Lnet/minecraft/class_2797;<init>(Ljava/lang/String;)V
      named <init> Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;<init>(Ljava/lang/String;)V
    • ChatMessageC2SPacket

      public ChatMessageC2SPacket(PacketByteBuf buf)
      Mappings:
      Namespace Name Mixin selector
      official <init> Lvb;<init>(Lpn;)V
      intermediary <init> Lnet/minecraft/class_2797;<init>(Lnet/minecraft/class_2540;)V
      named <init> Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;<init>(Lnet/minecraft/network/PacketByteBuf;)V
  • Method Details

    • write

      public void write(PacketByteBuf buf)
      Specified by:
      write in interface Packet<ServerPlayPacketListener>
      Mappings:
      Namespace Name Mixin selector
      official a Lqr;a(Lpn;)V
      intermediary method_11052 Lnet/minecraft/class_2596;method_11052(Lnet/minecraft/class_2540;)V
      named write Lnet/minecraft/network/Packet;write(Lnet/minecraft/network/PacketByteBuf;)V
    • apply

      public void apply(ServerPlayPacketListener serverPlayPacketListener)
      Specified by:
      apply in interface Packet<ServerPlayPacketListener>
      Mappings:
      Namespace Name Mixin selector
      official a Lvb;a(Lux;)V
      intermediary method_12115 Lnet/minecraft/class_2797;method_12115(Lnet/minecraft/class_2792;)V
      named apply Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;apply(Lnet/minecraft/network/listener/ServerPlayPacketListener;)V
    • getChatMessage

      public String getChatMessage()
      Mappings:
      Namespace Name Mixin selector
      official b Lvb;b()Ljava/lang/String;
      intermediary method_12114 Lnet/minecraft/class_2797;method_12114()Ljava/lang/String;
      named getChatMessage Lnet/minecraft/network/packet/c2s/play/ChatMessageC2SPacket;getChatMessage()Ljava/lang/String;