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

import dev.crucifixbeta.api.events.eventbus.EventListener;
import dev.crucifixbeta.api.events.impl.UpdateEvent;
import dev.crucifixbeta.mod.modules.Module;
import dev.crucifixbeta.mod.modules.settings.impl.BooleanSetting;
import dev.crucifixbeta.mod.modules.settings.impl.EnumSetting;
import java.util.Random;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.player.PlayerModelPart;

@Environment(EnvType.CLIENT)
public class SkinFlicker extends Module {
   private final EnumSetting<SkinFlicker.Mode> mode = this.add(new EnumSetting<>("Mode", SkinFlicker.Mode.Random));
   private final BooleanSetting cape = this.add(new BooleanSetting("CAPE", true));
   private final BooleanSetting jacket = this.add(new BooleanSetting("JACKET", true));
   private final BooleanSetting left_sleeve = this.add(new BooleanSetting("LEFT_SLEEVE", true));
   private final BooleanSetting right_sleeve = this.add(new BooleanSetting("RIGHT_SLEEVE", true));
   private final BooleanSetting leftPantsLeg = this.add(new BooleanSetting("LEFT_PANTS_LEG", true));
   private final BooleanSetting rightPantsLeg = this.add(new BooleanSetting("RIGHT_PANTS_LEG", true));
   private final BooleanSetting hat = this.add(new BooleanSetting("HAT", true));
   final Random random = new Random();
   boolean sync = false;

   public SkinFlicker() {
      super("SkinFlicker", Module.Category.Exploit);
      this.setChinese("\u76ae\u80a4\u95ea\u70c1");
   }

   @EventListener
   public void onUpdate(UpdateEvent event) {
      this.sync = !this.sync;

      for (PlayerModelPart var5 : PlayerModelPart.values()) {
         switch (var5.getId()) {
            case 0:
               if (!this.cape.getValue()) {
                  continue;
               }
               break;
            case 1:
               if (!this.jacket.getValue()) {
                  continue;
               }
               break;
            case 2:
               if (!this.left_sleeve.getValue()) {
                  continue;
               }
               break;
            case 3:
               if (!this.right_sleeve.getValue()) {
                  continue;
               }
               break;
            case 4:
               if (!this.leftPantsLeg.getValue()) {
                  continue;
               }
               break;
            case 5:
               if (!this.rightPantsLeg.getValue()) {
                  continue;
               }
               break;
            case 6:
               if (!this.hat.getValue()) {
                  continue;
               }
         }

         boolean var6 = true;
         switch ((SkinFlicker.Mode)this.mode.getValue()) {
            case Random:
               var6 = this.random.nextBoolean();
               break;
            case Switch:
               var6 = !mc.options.isPlayerModelPartEnabled(var5);
               break;
            case Sync:
               var6 = this.sync;
         }

         mc.options.togglePlayerModelPart(var5, var6);
      }
   }
@Environment(EnvType.CLIENT)
   private static enum Mode {
      Random,
      Switch,
      Sync;

}
}
