// Generated by delombok at Sat Oct 04 04:46:56 UTC 2025
package net.md_5.bungee.protocol;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class MinecraftEncoder extends MessageToByteEncoder<DefinedPacket> {
    private Protocol protocol;
    private boolean server;
    private int protocolVersion;

    @Override
    protected void encode(ChannelHandlerContext ctx, DefinedPacket msg, ByteBuf out) throws Exception {
        Protocol.DirectionData prot = (server) ? protocol.TO_CLIENT : protocol.TO_SERVER;
        DefinedPacket.writeVarInt(prot.getId(msg.getClass(), protocolVersion), out);
        msg.write(out, protocol, prot.getDirection(), protocolVersion);
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public MinecraftEncoder(final Protocol protocol, final boolean server, final int protocolVersion) {
        this.protocol = protocol;
        this.server = server;
        this.protocolVersion = protocolVersion;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public Protocol getProtocol() {
        return this.protocol;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setProtocol(final Protocol protocol) {
        this.protocol = protocol;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int getProtocolVersion() {
        return this.protocolVersion;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setProtocolVersion(final int protocolVersion) {
        this.protocolVersion = protocolVersion;
    }
}
