ServerboundPunchPacket 0x2E

ServerboundPunchPacket: Minecraft 26.3 packet (0x2E Play serverbound). Wire name 'punch', handled by ServerGamePacketListenerImpl.handlePunch().

Minecraft 26.3PlayServerboundnet.minecraft.network.protocol.game

Protocol slots (1)

IDdecStateDirectionRegistry
0x2E46PLAYServerboundGamePacketTypes.SERVERBOUND_PUNCH: "punch"

Packet ids are positional: the id is the index of the addPacket call in the protocol builder (see ProtocolInfoBuilder.listPackets). Ids change between game versions.

Wire fields (0)

FieldType
No wire fields (marker packet).

Fields are the components of the packet record.

Stream codec

static final StreamCodec<ByteBuf, ServerboundPunchPacket> STREAM_CODEC = StreamCodec.unit(INSTANCE);

Modern packets serialize through StreamCodecs instead of read/write methods.

Handling

Resolved on the ServerGamePacketListener packet-listener interface by void handlePunch(ServerboundPunchPacket serverboundpunchpacket). The implementation in the game is ServerGamePacketListenerImpl.

Full Source

ServerboundPunchPacket.java21 lines · Minecraft 26.3 · verbatimSource page ↗
1
package net.minecraft.network.protocol.game;
2
3
import io.netty.buffer.ByteBuf;
4
import net.minecraft.network.codec.StreamCodec;
5
import net.minecraft.network.protocol.Packet;
6
import net.minecraft.network.protocol.PacketType;
7
8
public record ServerboundPunchPacket() implements Packet<ServerGamePacketListener> {
9
	public static final ServerboundPunchPacket INSTANCE = new ServerboundPunchPacket();
10
	public static final StreamCodec<ByteBuf, ServerboundPunchPacket> STREAM_CODEC = StreamCodec.unit(INSTANCE);
11
12
	@Override
13
	public PacketType<ServerboundPunchPacket> type() {
14
		return GamePacketTypes.SERVERBOUND_PUNCH;
15
	}
16
17
	public void handle(final ServerGamePacketListener listener) {
18
		listener.handlePunch(this);
19
	}
20
}
21