ServerboundContainerClickPacket.java
net.minecraft.network.protocol.game.ServerboundContainerClickPacket
信息
- 全限定名:net.minecraft.network.protocol.game.ServerboundContainerClickPacket
- 类型:public record
- 包:net.minecraft.network.protocol.game
- 源码路径:src/main/java/net/minecraft/network/protocol/game/ServerboundContainerClickPacket.java
- 起始行号:L14
- 实现:Packet
- 职责:
TODO
字段/常量
-
MAX_SLOT_COUNT- 类型:
int - 修饰符:
private static final - 源码定位:
L23 - 说明:
TODO
- 类型:
-
SLOTS_STREAM_CODEC- 类型:
StreamCodec<RegistryFriendlyByteBuf,Int2ObjectMap<HashedStack>> - 修饰符:
private static final - 源码定位:
L24 - 说明:
TODO
- 类型:
-
STREAM_CODEC- 类型:
StreamCodec<RegistryFriendlyByteBuf,ServerboundContainerClickPacket> - 修饰符:
public static final - 源码定位:
L27 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
public ServerboundContainerClickPacket(int containerId, int stateId, short slotNum, byte buttonNum, ContainerInput containerInput, Int2ObjectMap<HashedStack> changedSlots, HashedStack carriedItem) @ L45
- 构造器名:ServerboundContainerClickPacket
- 源码定位:L45
- 修饰符:public
参数:
- containerId: int
- stateId: int
- slotNum: short
- buttonNum: byte
- containerInput: ContainerInput
- changedSlots: Int2ObjectMap
- carriedItem: HashedStack
说明:
TODO
方法
下面的方法块按源码顺序生成。
public PacketType<ServerboundContainerClickPacket> type() @ L64
- 方法名:type
- 源码定位:L64
- 返回类型:PacketType
- 修饰符:public
参数:
- 无
说明:
TODO
public void handle(ServerGamePacketListener listener) @ L69
- 方法名:handle
- 源码定位:L69
- 返回类型:void
- 修饰符:public
参数:
- listener: ServerGamePacketListener
说明:
TODO
代码
public record ServerboundContainerClickPacket(
int containerId,
int stateId,
short slotNum,
byte buttonNum,
ContainerInput containerInput,
Int2ObjectMap<HashedStack> changedSlots,
HashedStack carriedItem
) implements Packet<ServerGamePacketListener> {
private static final int MAX_SLOT_COUNT = 128;
private static final StreamCodec<RegistryFriendlyByteBuf, Int2ObjectMap<HashedStack>> SLOTS_STREAM_CODEC = ByteBufCodecs.map(
Int2ObjectOpenHashMap::new, ByteBufCodecs.SHORT.map(Short::intValue, Integer::shortValue), HashedStack.STREAM_CODEC, 128
);
public static final StreamCodec<RegistryFriendlyByteBuf, ServerboundContainerClickPacket> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.CONTAINER_ID,
ServerboundContainerClickPacket::containerId,
ByteBufCodecs.VAR_INT,
ServerboundContainerClickPacket::stateId,
ByteBufCodecs.SHORT,
ServerboundContainerClickPacket::slotNum,
ByteBufCodecs.BYTE,
ServerboundContainerClickPacket::buttonNum,
ContainerInput.STREAM_CODEC,
ServerboundContainerClickPacket::containerInput,
SLOTS_STREAM_CODEC,
ServerboundContainerClickPacket::changedSlots,
HashedStack.STREAM_CODEC,
ServerboundContainerClickPacket::carriedItem,
ServerboundContainerClickPacket::new
);
public ServerboundContainerClickPacket(
int containerId,
int stateId,
short slotNum,
byte buttonNum,
ContainerInput containerInput,
Int2ObjectMap<HashedStack> changedSlots,
HashedStack carriedItem
) {
changedSlots = Int2ObjectMaps.unmodifiable(changedSlots);
this.containerId = containerId;
this.stateId = stateId;
this.slotNum = slotNum;
this.buttonNum = buttonNum;
this.containerInput = containerInput;
this.changedSlots = changedSlots;
this.carriedItem = carriedItem;
}
@Override
public PacketType<ServerboundContainerClickPacket> type() {
return GamePacketTypes.SERVERBOUND_CONTAINER_CLICK;
}
public void handle(ServerGamePacketListener listener) {
listener.handleContainerClick(this);
}
}引用的其他类
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
字段
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
ByteBufCodecs.map()
- 引用位置:
-
- 引用位置:
字段/方法调用 - 关联成员:
StreamCodec.composite()
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
返回值
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置: