minecraft_25w45a_unobfuscated/net/minecraft/network/protocol/cookie/ServerboundCookieResponsePacket.java
2025-11-24 22:52:51 +03:00

43 lines
1.6 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* org.jspecify.annotations.Nullable
*/
package net.minecraft.network.protocol.cookie;
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.ClientboundStoreCookiePacket;
import net.minecraft.network.protocol.cookie.CookiePacketTypes;
import net.minecraft.network.protocol.cookie.ServerCookiePacketListener;
import net.minecraft.resources.Identifier;
import org.jspecify.annotations.Nullable;
public record ServerboundCookieResponsePacket(Identifier key, byte @Nullable [] payload) implements Packet<ServerCookiePacketListener>
{
public static final StreamCodec<FriendlyByteBuf, ServerboundCookieResponsePacket> STREAM_CODEC = Packet.codec(ServerboundCookieResponsePacket::write, ServerboundCookieResponsePacket::new);
private ServerboundCookieResponsePacket(FriendlyByteBuf input) {
this(input.readIdentifier(), input.readNullable(ClientboundStoreCookiePacket.PAYLOAD_STREAM_CODEC));
}
private void write(FriendlyByteBuf output) {
output.writeIdentifier(this.key);
output.writeNullable(this.payload, ClientboundStoreCookiePacket.PAYLOAD_STREAM_CODEC);
}
@Override
public PacketType<ServerboundCookieResponsePacket> type() {
return CookiePacketTypes.SERVERBOUND_COOKIE_RESPONSE;
}
@Override
public void handle(ServerCookiePacketListener listener) {
listener.handleCookieResponse(this);
}
}