/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.mojang.authlib.GameProfile
 *  net.minecraft.class_1068
 *  net.minecraft.class_310
 *  net.minecraft.class_640
 *  net.minecraft.class_8685
 *  org.spongepowered.asm.mixin.Mixin
 *  org.spongepowered.asm.mixin.Shadow
 *  org.spongepowered.asm.mixin.injection.At
 *  org.spongepowered.asm.mixin.injection.Inject
 *  org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
 */
package meteordevelopment.meteorclient.mixin;

import com.mojang.authlib.GameProfile;
import meteordevelopment.meteorclient.systems.modules.Modules;
import meteordevelopment.meteorclient.systems.modules.player.NameProtect;
import meteordevelopment.meteorclient.systems.modules.player.SkinChanger;
import net.minecraft.class_1068;
import net.minecraft.class_310;
import net.minecraft.class_640;
import net.minecraft.class_8685;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(value={class_640.class})
public abstract class PlayerListEntryMixin {
    @Shadow
    public abstract GameProfile method_2966();

    @Inject(method={"method_52810"}, at={@At(value="HEAD")}, cancellable=true)
    private void onGetTexture(CallbackInfoReturnable<class_8685> info) {
        if (Modules.get() == null) {
            return;
        }
        if (this.method_2966().name().equals(class_310.method_1551().method_1548().method_1676())) {
            class_8685 textures;
            SkinChanger skinChanger = Modules.get().get(SkinChanger.class);
            if (skinChanger.isActive() && (textures = skinChanger.getTextures()) != null) {
                info.setReturnValue((Object)textures);
                return;
            }
            if (Modules.get().get(NameProtect.class).skinProtect()) {
                info.setReturnValue((Object)class_1068.method_52854((GameProfile)this.method_2966()));
            }
        }
    }
}

