41 lines
2.2 KiB
Java
41 lines
2.2 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.google.common.collect.Lists
|
|
*/
|
|
package net.minecraft.network.protocol.common;
|
|
|
|
import com.google.common.collect.Lists;
|
|
import java.util.List;
|
|
import net.minecraft.network.FriendlyByteBuf;
|
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
|
import net.minecraft.network.codec.StreamCodec;
|
|
import net.minecraft.network.protocol.Packet;
|
|
import net.minecraft.network.protocol.PacketType;
|
|
import net.minecraft.network.protocol.common.ClientCommonPacketListener;
|
|
import net.minecraft.network.protocol.common.CommonPacketTypes;
|
|
import net.minecraft.network.protocol.common.custom.BrandPayload;
|
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
|
import net.minecraft.network.protocol.common.custom.DiscardedPayload;
|
|
import net.minecraft.resources.Identifier;
|
|
import net.minecraft.util.Util;
|
|
|
|
public record ClientboundCustomPayloadPacket(CustomPacketPayload payload) implements Packet<ClientCommonPacketListener>
|
|
{
|
|
private static final int MAX_PAYLOAD_SIZE = 0x100000;
|
|
public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundCustomPayloadPacket> GAMEPLAY_STREAM_CODEC = CustomPacketPayload.codec((Identifier id) -> DiscardedPayload.codec(id, 0x100000), Util.make(Lists.newArrayList((Object[])new CustomPacketPayload.TypeAndCodec[]{new CustomPacketPayload.TypeAndCodec<FriendlyByteBuf, BrandPayload>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)}), types -> {})).map(ClientboundCustomPayloadPacket::new, ClientboundCustomPayloadPacket::payload);
|
|
public static final StreamCodec<FriendlyByteBuf, ClientboundCustomPayloadPacket> CONFIG_STREAM_CODEC = CustomPacketPayload.codec((Identifier id) -> DiscardedPayload.codec(id, 0x100000), List.of(new CustomPacketPayload.TypeAndCodec<FriendlyByteBuf, BrandPayload>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC))).map(ClientboundCustomPayloadPacket::new, ClientboundCustomPayloadPacket::payload);
|
|
|
|
@Override
|
|
public PacketType<ClientboundCustomPayloadPacket> type() {
|
|
return CommonPacketTypes.CLIENTBOUND_CUSTOM_PAYLOAD;
|
|
}
|
|
|
|
@Override
|
|
public void handle(ClientCommonPacketListener listener) {
|
|
listener.handleCustomPayload(this);
|
|
}
|
|
}
|
|
|