This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
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<ClientboundShellClosedPayload> TYPE = new CustomPacketPayload.Type<>(SHELL_CLOSED_PAYLOAD_ID);
|
||||
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, ClientboundShellClosedPayload> CODEC =
|
||||
StreamCodec.composite(
|
||||
ByteBufCodecs.STRING_UTF8,
|
||||
ClientboundShellClosedPayload::reason,
|
||||
ClientboundShellClosedPayload::new
|
||||
);
|
||||
|
||||
@Override
|
||||
public Type<? extends CustomPacketPayload> type() {
|
||||
return TYPE;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user