27 lines
1.1 KiB
Java
27 lines
1.1 KiB
Java
|
package net.minecraft.network.protocol.game;
|
||
|
|
||
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||
|
import net.minecraft.network.codec.StreamCodec;
|
||
|
import net.minecraft.network.protocol.Packet;
|
||
|
import net.minecraft.network.protocol.PacketType;
|
||
|
import net.minecraft.world.item.ItemStack;
|
||
|
|
||
|
public record ClientboundSetPlayerInventoryPacket(int slot, ItemStack contents) implements Packet<ClientGamePacketListener> {
|
||
|
public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundSetPlayerInventoryPacket> STREAM_CODEC = StreamCodec.composite(
|
||
|
ByteBufCodecs.VAR_INT,
|
||
|
ClientboundSetPlayerInventoryPacket::slot,
|
||
|
ItemStack.OPTIONAL_STREAM_CODEC,
|
||
|
ClientboundSetPlayerInventoryPacket::contents,
|
||
|
ClientboundSetPlayerInventoryPacket::new
|
||
|
);
|
||
|
|
||
|
@Override
|
||
|
public PacketType<ClientboundSetPlayerInventoryPacket> type() {
|
||
|
return GamePacketTypes.CLIENTBOUND_SET_PLAYER_INVENTORY;
|
||
|
}
|
||
|
|
||
|
public void handle(ClientGamePacketListener p_369117_) {
|
||
|
p_369117_.handleSetPlayerInventory(this);
|
||
|
}
|
||
|
}
|