ServerboundInteractPacket .java

net.minecraft.network.protocol.game.ServerboundInteractPacket (record, 34 lines): members: entityId, hand, location, usingSecondaryAction, handle, type.

net.minecraft.network.protocol.gamerecord34 linescommon1.1 KB

Implements

API Surface (2)

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

Fields & Constants (1)

STREAM_CODEC

Same Package (197)

Full Source

ServerboundInteractPacket.java34 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import io.netty.buffer.ByteBuf;
4
import net.minecraft.network.codec.ByteBufCodecs;
5
import net.minecraft.network.codec.StreamCodec;
6
import net.minecraft.network.protocol.Packet;
7
import net.minecraft.network.protocol.PacketType;
8
import net.minecraft.world.InteractionHand;
9
import net.minecraft.world.phys.Vec3;
10
11
public record ServerboundInteractPacket(int entityId, InteractionHand hand, Vec3 location, boolean usingSecondaryAction)
12
	implements Packet<ServerGamePacketListener> {
13
	public static final StreamCodec<ByteBuf, ServerboundInteractPacket> STREAM_CODEC = StreamCodec.composite(
14
		ByteBufCodecs.VAR_INT,
15
		ServerboundInteractPacket::entityId,
16
		InteractionHand.STREAM_CODEC,
17
		ServerboundInteractPacket::hand,
18
		Vec3.LP_STREAM_CODEC,
19
		ServerboundInteractPacket::location,
20
		ByteBufCodecs.BOOL,
21
		ServerboundInteractPacket::usingSecondaryAction,
22
		ServerboundInteractPacket::new
23
	);
24
25
	@Override
26
	public PacketType<ServerboundInteractPacket> type() {
27
		return GamePacketTypes.SERVERBOUND_INTERACT;
28
	}
29
30
	public void handle(final ServerGamePacketListener listener) {
31
		listener.handleInteract(this);
32
	}
33
}
34

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