package com.acethewildfire.acesbs.util;

import com.acethewildfire.acesbs.AcesBS;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.network.codec.PacketCodec;
import net.minecraft.network.codec.PacketCodecs;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.util.Identifier;

public class ModPackets {
    public static final Identifier SET_COMMAND = Identifier.of(AcesBS.MOD_ID, "set_command");

    public record SetCommandPayload(String option) implements CustomPayload {

        public static final Id<SetCommandPayload> ID =
                new Id<>(Identifier.of("mymod", "set_option"));

        public static final PacketCodec<RegistryByteBuf, SetCommandPayload> CODEC =
                PacketCodec.tuple(
                        PacketCodecs.STRING,
                        SetCommandPayload::option,
                        SetCommandPayload::new
                );

        @Override
        public Id<? extends CustomPayload> getId() {
            return ID;
        }
    }
}
