package dev.crucifixbeta.mod.modules.impl.render;

import dev.crucifixbeta.mod.modules.Module;
import dev.crucifixbeta.mod.modules.settings.impl.EnumSetting;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.util.Identifier;

@Environment(EnvType.CLIENT)
public class CapeChanger extends Module {
   public static CapeChanger INSTANCE;
   public final EnumSetting<CapeChanger.Mode> mode = this.add(new EnumSetting<>("Mode", CapeChanger.Mode.Self));
   public final EnumSetting<CapeChanger.CapeType> capeType = this.add(new EnumSetting<>("CapeType", CapeChanger.CapeType.LiquidBounce));

   public CapeChanger() {
      super("CapeChanger", Module.Category.Render);
      this.setChinese("\u62ab\u98ce\u66ff\u6362");
      INSTANCE = this;
   }

   public static Identifier getCustomCape() {
      try {
         return buildCapeIdentifier(INSTANCE != null ? INSTANCE.capeType.getValue() : CapeChanger.CapeType.LiquidBounce);
      } catch (Exception var1) {
         return buildCapeIdentifier(CapeChanger.CapeType.LiquidBounce);
      }
   }

   public boolean shouldReplaceCape(AbstractClientPlayerEntity player) {
      return this.mode.getValue() == CapeChanger.Mode.AllPlayers ? true : player == mc.player;
   }

   private static Identifier buildCapeIdentifier(CapeChanger.CapeType capeType) {
      String var1 = capeType.getFileName();
      return Identifier.of("alien", "textures/cape/" + var1);
   }
@Environment(EnvType.CLIENT)
   public static enum CapeType {
      LiquidBounce("liquidbounce.png"),
      Mio("mio.png"),
      CrucifiX("opal.png"),
      Rise("rise.png"),
      VapeLite("vapelite.png"),
      VapeV4("vapev4.png"),
      Num15("15.png"),
      aixin("aixin.png"),
      Liu3("liu3.png"),
      LiuHua("liuhua.png"),
      LiuHua2("liuhua2.png"),
      SanJiu("sanjiu.png");

      private final String fileName;

      private CapeType(String fileName) {
         this.fileName = fileName;
      }

      public String getFileName() {
         return this.fileName;
      }

}

   @Environment(EnvType.CLIENT)
   public static enum Mode {
      Self,
      AllPlayers;

}
}
