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 bea, final boolean boolean4, final int integer5, final HumanoidArm aou) {
        this.language = string;
        this.viewDistance = integer2;
        this.chatVisibility = bea;
        this.chatColors = boolean4;
        this.modelCustomisation = integer5;
        this.mainHand = aou;
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.language = mg.readUtf(16);
        this.viewDistance = mg.readByte();
        this.chatVisibility = mg.<ChatVisiblity>readEnum(ChatVisiblity.class);
        this.chatColors = mg.readBoolean();
        this.modelCustomisation = mg.readUnsignedByte();
        this.mainHand = mg.<HumanoidArm>readEnum(HumanoidArm.class);
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeUtf(this.language);
        mg.writeByte(this.viewDistance);
        mg.writeEnum(this.chatVisibility);
        mg.writeBoolean(this.chatColors);
        mg.writeByte(this.modelCustomisation);
        mg.writeEnum(this.mainHand);
    }
    
    @Override
    public void handle(final ServerGamePacketListener qz) {
        qz.handleClientInformation(this);
    }
    
    public ChatVisiblity getChatVisibility() {
        return this.chatVisibility;
    }
    
    public boolean getChatColors() {
        return this.chatColors;
    }
    
    public int getModelCustomisation() {
        return this.modelCustomisation;
    }
    
    public HumanoidArm getMainHand() {
        return this.mainHand;
    }
}
