ServerboundCustomClickActionPacket .java

net.minecraft.network.protocol.common.ServerboundCustomClickActionPacket (record): members: payload, UNTRUSTED_TAG_CODEC, handle, STREAM_CODEC, type.

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

Implements

API Surface (2)

PacketType<ServerboundCustomClickActionPacket> type()
void handle(final ServerCommonPacketListener listener)

Fields & Constants (2)

UNTRUSTED_TAG_CODEC
STREAM_CODEC

Full Source

ServerboundCustomClickActionPacket.java33 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.common;
2
3
import io.netty.buffer.ByteBuf;
4
import java.util.Optional;
5
import net.minecraft.nbt.NbtAccounter;
6
import net.minecraft.nbt.Tag;
7
import net.minecraft.network.codec.ByteBufCodecs;
8
import net.minecraft.network.codec.StreamCodec;
9
import net.minecraft.network.protocol.Packet;
10
import net.minecraft.network.protocol.PacketType;
11
import net.minecraft.resources.Identifier;
12
13
public record ServerboundCustomClickActionPacket(Identifier id, Optional<Tag> payload) implements Packet<ServerCommonPacketListener> {
14
	private static final StreamCodec<ByteBuf, Optional<Tag>> UNTRUSTED_TAG_CODEC = ByteBufCodecs.optionalTagCodec(() -> new NbtAccounter(32768L, 16))
15
		.apply(ByteBufCodecs.lengthPrefixed(65536));
16
	public static final StreamCodec<ByteBuf, ServerboundCustomClickActionPacket> STREAM_CODEC = StreamCodec.composite(
17
		Identifier.STREAM_CODEC,
18
		ServerboundCustomClickActionPacket::id,
19
		UNTRUSTED_TAG_CODEC,
20
		ServerboundCustomClickActionPacket::payload,
21
		ServerboundCustomClickActionPacket::new
22
	);
23
24
	@Override
25
	public PacketType<ServerboundCustomClickActionPacket> type() {
26
		return CommonPacketTypes.SERVERBOUND_CUSTOM_CLICK_ACTION;
27
	}
28
29
	public void handle(final ServerCommonPacketListener listener) {
30
		listener.handleCustomClickAction(this);
31
	}
32
}
33

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