/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  net.minecraft.class_640
 *  net.minecraft.class_8685
 */
package meteordevelopment.meteorclient.systems.modules.player;

import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.settings.StringSetting;
import meteordevelopment.meteorclient.systems.modules.Categories;
import meteordevelopment.meteorclient.systems.modules.Module;
import net.minecraft.class_640;
import net.minecraft.class_8685;

public class SkinChanger
extends Module {
    private final SettingGroup sgGeneral;
    private final Setting<String> skinName;
    private class_8685 textures;

    public SkinChanger() {
        super(Categories.Player, "skin-changer", "Changes your skin in-game. (Visual only)");
        this.sgGeneral = this.settings.getDefaultGroup();
        this.skinName = this.sgGeneral.add(((StringSetting.Builder)((StringSetting.Builder)((StringSetting.Builder)((StringSetting.Builder)new StringSetting.Builder().name("username")).description("The name of the player whose skin you want to use.")).defaultValue("Dinnerbone")).onChanged(s -> this.updateSkin())).build());
    }

    @Override
    public void onActivate() {
        this.updateSkin();
    }

    private void updateSkin() {
        if (this.mc.method_1562() == null) {
            return;
        }
        class_640 entry = this.mc.method_1562().method_2874(this.skinName.get());
        this.textures = entry != null ? entry.method_52810() : null;
    }

    public class_8685 getTextures() {
        if (this.textures == null) {
            this.updateSkin();
        }
        return this.textures;
    }
}

