package com.aranroig.payloads; import com.aranroig.Codecraft; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.resources.Identifier; /** * The shell is gone — it exited on its own or could not be started — and says * why, which the terminal pane prints as a dim note. */ public record ClientboundShellClosedPayload(String reason) implements CustomPacketPayload { public static final Identifier SHELL_CLOSED_PAYLOAD_ID = Identifier.fromNamespaceAndPath(Codecraft.MOD_ID, "shell_closed"); public static final CustomPacketPayload.Type TYPE = new CustomPacketPayload.Type<>(SHELL_CLOSED_PAYLOAD_ID); public static final StreamCodec CODEC = StreamCodec.composite( ByteBufCodecs.STRING_UTF8, ClientboundShellClosedPayload::reason, ClientboundShellClosedPayload::new ); @Override public Type type() { return TYPE; } }