package net.minecraft.network.protocol.game;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.HumanoidArm;
import net.minecraft.world.entity.player.ChatVisiblity;
import net.minecraft.network.protocol.Packet;

public class ServerboundClientInformationPacket implements Packet<ServerGamePacketListener> {
    private String language;
    private int viewDistance;
    private ChatVisiblity chatVisibility;
    private boolean chatColors;
    private int modelCustomisation;
    private HumanoidArm mainHand;
    
    public ServerboundClientInformationPacket() {
    }
    
    public ServerboundClientInformationPacket(final String string, final int integer2, final ChatVisiblity ayh, final boolean boolean4, final int integer5, final HumanoidArm aky) {
        this.language = string;
        this.viewDistance = integer2;
        this.chatVisibility = ayh;
        this.chatColors = boolean4;
        this.modelCustomisation = integer5;
        this.mainHand = aky;
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.language = kv.readUtf(16);
        this.viewDistance = kv.readByte();
        this.chatVisibility = kv.<ChatVisiblity>readEnum(ChatVisiblity.class);
        this.chatColors = kv.readBoolean();
        this.modelCustomisation = kv.readUnsignedByte();
        this.mainHand = kv.<HumanoidArm>readEnum(HumanoidArm.class);
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeUtf(this.language);
        kv.writeByte(this.viewDistance);
        kv.writeEnum(this.chatVisibility);
        kv.writeBoolean(this.chatColors);
        kv.writeByte(this.modelCustomisation);
        kv.writeEnum(this.mainHand);
    }
    
    @Override
    public void handle(final ServerGamePacketListener pl) {
        pl.handleClientInformation(this);
    }
    
    public String getLanguage() {
        return this.language;
    }
    
    public ChatVisiblity getChatVisibility() {
        return this.chatVisibility;
    }
    
    public boolean getChatColors() {
        return this.chatColors;
    }
    
    public int getModelCustomisation() {
        return this.modelCustomisation;
    }
    
    public HumanoidArm getMainHand() {
        return this.mainHand;
    }
}
