ClientboundContainerSetContentPacket .java

net.minecraft.network.protocol.game.ClientboundContainerSetContentPacket (record): members: containerId, stateId, items, carriedItem, handle, STREAM_CODEC.

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

Implements

API Surface (2)

PacketType<ClientboundContainerSetContentPacket> type()
void handle(final ClientGamePacketListener listener)

Fields & Constants (1)

STREAM_CODEC

Same Package (197)

Full Source

ClientboundContainerSetContentPacket.java34 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import java.util.List;
4
import net.minecraft.network.RegistryFriendlyByteBuf;
5
import net.minecraft.network.codec.ByteBufCodecs;
6
import net.minecraft.network.codec.StreamCodec;
7
import net.minecraft.network.protocol.Packet;
8
import net.minecraft.network.protocol.PacketType;
9
import net.minecraft.world.item.ItemStack;
10
11
public record ClientboundContainerSetContentPacket(int containerId, int stateId, List<ItemStack> items, ItemStack carriedItem)
12
	implements Packet<ClientGamePacketListener> {
13
	public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundContainerSetContentPacket> STREAM_CODEC = StreamCodec.composite(
14
		ByteBufCodecs.CONTAINER_ID,
15
		ClientboundContainerSetContentPacket::containerId,
16
		ByteBufCodecs.VAR_INT,
17
		ClientboundContainerSetContentPacket::stateId,
18
		ItemStack.OPTIONAL_LIST_STREAM_CODEC,
19
		ClientboundContainerSetContentPacket::items,
20
		ItemStack.OPTIONAL_STREAM_CODEC,
21
		ClientboundContainerSetContentPacket::carriedItem,
22
		ClientboundContainerSetContentPacket::new
23
	);
24
25
	@Override
26
	public PacketType<ClientboundContainerSetContentPacket> type() {
27
		return GamePacketTypes.CLIENTBOUND_CONTAINER_SET_CONTENT;
28
	}
29
30
	public void handle(final ClientGamePacketListener listener) {
31
		listener.handleContainerContent(this);
32
	}
33
}
34

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