38 lines
1.7 KiB
Java
38 lines
1.7 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 net.minecraft.network.FriendlyByteBuf;
|
|
import net.minecraft.network.codec.StreamCodec;
|
|
import net.minecraft.network.protocol.Packet;
|
|
import net.minecraft.network.protocol.PacketType;
|
|
import net.minecraft.network.protocol.common.CommonPacketTypes;
|
|
import net.minecraft.network.protocol.common.ServerCommonPacketListener;
|
|
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 ServerboundCustomPayloadPacket(CustomPacketPayload payload) implements Packet<ServerCommonPacketListener>
|
|
{
|
|
private static final int MAX_PAYLOAD_SIZE = Short.MAX_VALUE;
|
|
public static final StreamCodec<FriendlyByteBuf, ServerboundCustomPayloadPacket> STREAM_CODEC = CustomPacketPayload.codec((Identifier id) -> DiscardedPayload.codec(id, Short.MAX_VALUE), Util.make(Lists.newArrayList((Object[])new CustomPacketPayload.TypeAndCodec[]{new CustomPacketPayload.TypeAndCodec<FriendlyByteBuf, BrandPayload>(BrandPayload.TYPE, BrandPayload.STREAM_CODEC)}), types -> {})).map(ServerboundCustomPayloadPacket::new, ServerboundCustomPayloadPacket::payload);
|
|
|
|
@Override
|
|
public PacketType<ServerboundCustomPayloadPacket> type() {
|
|
return CommonPacketTypes.SERVERBOUND_CUSTOM_PAYLOAD;
|
|
}
|
|
|
|
@Override
|
|
public void handle(ServerCommonPacketListener listener) {
|
|
listener.handleCustomPayload(this);
|
|
}
|
|
}
|
|
|