ClientboundOpenScreenPacket .java

net.minecraft.network.protocol.game.ClientboundOpenScreenPacket (class): members: getContainerId, containerId, getTitle, title, getType, handle, type.

net.minecraft.network.protocol.gameclass54 linescommon1.6 KB

Implements

API Surface (5)

PacketType<ClientboundOpenScreenPacket> type()
void handle(final ClientGamePacketListener listener)
int getContainerId()
MenuType<?> getType()
Component getTitle()

Fields & Constants (4)

STREAM_CODEC
containerId
type
title

Same Package (197)

Full Source

ClientboundOpenScreenPacket.java54 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.network.protocol.game;
2
3
import net.minecraft.core.registries.Registries;
4
import net.minecraft.network.RegistryFriendlyByteBuf;
5
import net.minecraft.network.chat.Component;
6
import net.minecraft.network.chat.ComponentSerialization;
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.world.inventory.MenuType;
12
13
public class ClientboundOpenScreenPacket implements Packet<ClientGamePacketListener> {
14
	public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundOpenScreenPacket> STREAM_CODEC = StreamCodec.composite(
15
		ByteBufCodecs.CONTAINER_ID,
16
		ClientboundOpenScreenPacket::getContainerId,
17
		ByteBufCodecs.registry(Registries.MENU),
18
		ClientboundOpenScreenPacket::getType,
19
		ComponentSerialization.TRUSTED_STREAM_CODEC,
20
		ClientboundOpenScreenPacket::getTitle,
21
		ClientboundOpenScreenPacket::new
22
	);
23
	private final int containerId;
24
	private final MenuType<?> type;
25
	private final Component title;
26
27
	public ClientboundOpenScreenPacket(final int containerId, final MenuType<?> type, final Component title) {
28
		this.containerId = containerId;
29
		this.type = type;
30
		this.title = title;
31
	}
32
33
	@Override
34
	public PacketType<ClientboundOpenScreenPacket> type() {
35
		return GamePacketTypes.CLIENTBOUND_OPEN_SCREEN;
36
	}
37
38
	public void handle(final ClientGamePacketListener listener) {
39
		listener.handleOpenScreen(this);
40
	}
41
42
	public int getContainerId() {
43
		return this.containerId;
44
	}
45
46
	public MenuType<?> getType() {
47
		return this.type;
48
	}
49
50
	public Component getTitle() {
51
		return this.title;
52
	}
53
}
54

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