ServerboundChatPacket .java

net.minecraft.network.protocol.game.ServerboundChatPacket (record, 38 lines): members: message, timeStamp, salt, signature, lastSeenMessages, handle, type.

net.minecraft.network.protocol.gamerecord38 linescommon1.3 KB

Implements

API Surface (2)

PacketType<ServerboundChatPacket> type()
void handle(final ServerGamePacketListener listener)

Fields & Constants (1)

STREAM_CODEC

Same Package (197)

Full Source

ServerboundChatPacket.java38 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import java.time.Instant;
4
import java.util.Optional;
5
import net.minecraft.network.FriendlyByteBuf;
6
import net.minecraft.network.chat.LastSeenMessages;
7
import net.minecraft.network.chat.MessageSignature;
8
import net.minecraft.network.codec.ByteBufCodecs;
9
import net.minecraft.network.codec.StreamCodec;
10
import net.minecraft.network.protocol.Packet;
11
import net.minecraft.network.protocol.PacketType;
12
13
public record ServerboundChatPacket(String message, Instant timeStamp, long salt, Optional<MessageSignature> signature, LastSeenMessages.Update lastSeenMessages)
14
	implements Packet<ServerGamePacketListener> {
15
	public static final StreamCodec<FriendlyByteBuf, ServerboundChatPacket> STREAM_CODEC = StreamCodec.composite(
16
		ByteBufCodecs.stringUtf8(256),
17
		ServerboundChatPacket::message,
18
		ByteBufCodecs.INSTANT,
19
		ServerboundChatPacket::timeStamp,
20
		ByteBufCodecs.LONG,
21
		ServerboundChatPacket::salt,
22
		MessageSignature.STREAM_CODEC.apply(ByteBufCodecs::optional),
23
		ServerboundChatPacket::signature,
24
		LastSeenMessages.Update.STREAM_CODEC,
25
		ServerboundChatPacket::lastSeenMessages,
26
		ServerboundChatPacket::new
27
	);
28
29
	@Override
30
	public PacketType<ServerboundChatPacket> type() {
31
		return GamePacketTypes.SERVERBOUND_CHAT;
32
	}
33
34
	public void handle(final ServerGamePacketListener listener) {
35
		listener.handleChat(this);
36
	}
37
}
38

Decompiled Minecraft 26.3 source of ServerboundChatPacket (net/minecraft/network/protocol/game/ServerboundChatPacket.java) with Mojang official mappings, stored verbatim on the site.