package fucin.scymmer.module.impl.Render;
import fucin.scymmer.NativeCC;
import fucin.scymmer.event.EventTarget;
import fucin.scymmer.event.events.impl.render.EventRender2D;
import fucin.scymmer.module.Module;
import fucin.scymmer.module.ModuleCategory;
import fucin.scymmer.ui.settings.Setting;
import fucin.scymmer.ui.settings.impl.BooleanSetting;
import fucin.scymmer.ui.settings.impl.ColorSetting;
import fucin.scymmer.ui.settings.impl.ListSetting;
import fucin.scymmer.ui.settings.impl.NumberSetting;
import fucin.scymmer.utils.Helper;
import fucin.scymmer.utils.math.AnimationHelper;
import fucin.scymmer.utils.render.ClientHelper;
import fucin.scymmer.utils.render.GLUtils;
import fucin.scymmer.utils.render.RenderUtils;
import fucin.scymmer.utils.render.RoundedUtil;
import net.minecraft.potion.PotionEffect;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
public class KeyBind extends Module {
public float scale = 2.0F;
public static ListSetting modw = new ListSetting("List Mode", "Shader", () -> {
return true;
}, new String[]{"Shader", "New"});
public static BooleanSetting background = new BooleanSetting("Background", true, () -> {
return true;
});
public static BooleanSetting right = new BooleanSetting("Right", false, () -> {
return false;
});
public NumberSetting offsetY = new NumberSetting("Offset Y", 10.78F, 10.0F, 12.0F, 0.01F, () -> {
return true;
});
public NumberSetting y = new NumberSetting("Pos Y", 15.0F, -6.0F, 1000.0F, 0.01F, () -> {
return true;
});
public NumberSetting x = new NumberSetting("Pos X", 15.0F, 1.2F, 1000.0F, 0.01F, () -> {
return true;
});
public static NumberSetting roundvalue = new NumberSetting("Round Value", 5.0F, 2.0F, 6.0F, 1.0F, () -> {
return modw.currentMode.equals("New");
});
public BooleanSetting rightBorder = new BooleanSetting("Left Border", true, () -> {
return true;
});
public BooleanSetting onlyBinds = new BooleanSetting("Only Binds", true, () -> {
return true;
});
public BooleanSetting noVisualModules = new BooleanSetting("No Visuals", false, () -> {
return true;
});
public BooleanSetting glow = new BooleanSetting("Glow", false, () -> {
return true;
});
public BooleanSetting lowercase = new BooleanSetting("LowerCase", false, () -> {
return true;
});
public ColorSetting eblo = new ColorSetting("Border Color", (new Color(255, 255, 255)).getRGB(), () -> {
return true;
});
public ColorSetting ebalocolor = new ColorSetting("Text Color", (new Color(255, 255, 255)).getRGB(), () -> {
return true;
});
public NumberSetting glowRadius = new NumberSetting("Glow Radius", 10.0F, 0.0F, 50.0F, 1.0F, () -> {
return this.glow.getCurrentValue();
});
public NumberSetting glowAlpha = new NumberSetting("Glow Alpha", 80.0F, 30.0F, 255.0F, 1.0F, () -> {
return this.glow.getCurrentValue();
});
public KeyBind() {
super("KeyBind", "Показывает лист модулей, которые включены", ModuleCategory.Render);
this.addSettings(new Setting[]{ this.y, this.x});
}
@EventTarget
public void Event2D(EventRender2D event) {
if (this.isEnabled()) {
List<Module> activeModules = NativeCC.instance.featureManager.getAllFeatures();
activeModules.sort(Comparator.comparingDouble((s) -> {
return (double)(-ClientHelper.mc.mntsb_18.getStringWidth(s.getLabel()));
}));
float displayWidth = (float)event.getResolution().getScaledWidth() * ((float)event.getResolution().getScaleFactor() / 2.0F);
float yPotionOffset = this.y.getCurrentValue();
Iterator var5 = Helper.mc.player.getActivePotionEffects().iterator();
while(var5.hasNext()) {
PotionEffect potionEffect = (PotionEffect)var5.next();
if (potionEffect.getPotion().isBeneficial()) {
yPotionOffset = this.y.getCurrentValue();
}
if (potionEffect.getPotion().isBadEffect()) {
yPotionOffset = this.y.getCurrentValue();
}
}
int y = (int)(5.0F + yPotionOffset);
int yTotal = 0;
for(int i = 0; i < NativeCC.instance.featureManager.getAllFeatures().size(); ++i) {
yTotal += ClientHelper.mc.mntsb_18.getFontHeight() + 3;
}
Iterator var12 = activeModules.iterator();
while(true) {
Module module;
do {
do {
do {
do {
if (!var12.hasNext()) {
return;
}
module = (Module) var12.next();
if (modw.currentMode.equals("Shader")) {
module.animYto = AnimationHelper.Move(module.animYto, module.isEnabled() ? 1.0F : 0.0F, (float)(1233.0 * NativeCC.deltaTime()), (float)(1233.0 * NativeCC.deltaTime()), (float)NativeCC.deltaTime());
}
if (modw.currentMode.equals("New")) {
module.animYto = AnimationHelper.Move(module.animYto, module.isEnabled() ? 0.99F : 0.0F, (float)(2.0 * NativeCC.deltaTime()), (float)(7.0 * NativeCC.deltaTime()), (float)NativeCC.deltaTime());
}
} while(!(module.animYto > 0.0F));
} while(module.getLabel().equals("ClickGui"));
} while(this.noVisualModules.getCurrentValue() && module.getCategory() == ModuleCategory.Render);
} while(this.onlyBinds.getCurrentValue() && module.getBind() == 0);
GLUtils.INSTANCE.rescaleMC();
GL11.glPushMatrix();
GL11.glTranslated((double)this.x.getCurrentValue(), (double)y, 1.0);
GL11.glScaled(1.0, (double)module.animYto, 10.0);
GL11.glTranslated(-1.0, (double)(-y), 1.0);
RoundedUtil.drawGradientRound(3, yPotionOffset - 7, 100, 13, 0, new Color(0, 0, 0), new Color(0, 0, 0), new Color(0, 0, 0), new Color(0, 0, 0));
RoundedUtil.drawGradientRound(3F, (float) y + 2.2F, 100, 10.55F - 2.3F,0.0F, new Color(0, 0, 0, 160), new Color(0, 0, 0, 160), new Color(0, 0, 0, 160), new Color(0, 0, 0, 160));
//RenderUtils.drawRect2(3, yPotionOffset + 6, 100, 0.7F,new Color(88, 88, 88, 150).getRGB());
RenderUtils.drawRect2(2.5, yPotionOffset -8, 101, 1F,ClientHelper.getClientColor().getRGB());
Object backGroundColorMode;
if (this.lowercase.getCurrentValue() && modw.currentMode.equals("New") && background.getCurrentValue()) {
backGroundColorMode = null;
RenderUtils.drawRect(-1.0, (double)y, (double)(ClientHelper.mc.mntsb_18.getStringWidth(module.getLabel()) + 6), (double)((float)y + this.offsetY.getCurrentValue()), RenderUtils.injectAlpha(ClientHelper.getClientColor((float)y, (float)yTotal, 192), 200).getRGB());
}
if (!this.lowercase.getCurrentValue() && modw.currentMode.equals("New") && background.getCurrentValue() && !this.rightBorder.getCurrentValue()) {
backGroundColorMode = null;
RenderUtils.drawRect2(-0.4, (double)y, (double)(ClientHelper.mc.mntsb_18.getStringWidth(module.getLabel()) + 6), (double)this.offsetY.getCurrentValue(), ClientHelper.getClientColor().getRGB());
}
if (!this.lowercase.getCurrentValue() && modw.currentMode.equals("New") && background.getCurrentValue() && this.rightBorder.getCurrentValue()) {
backGroundColorMode = null;
RenderUtils.drawRect2(-0.4, (double)y, (double)(ClientHelper.mc.mntsb_18.getStringWidth(module.getLabel()) + 6), (double)this.offsetY.getCurrentValue(), ClientHelper.getClientColor().getRGB());
}
if (modw.currentMode.equals("New") && this.rightBorder.getCurrentValue()) {
RenderUtils.drawRect2(2.9, (double)y, 0.2, (double)((float)y + this.offsetY.getCurrentValue()), Color.WHITE.getRGB());
}
if (modw.currentMode.equals("Shader") && this.rightBorder.getCurrentValue()) {
}
float c;
float f;
if (modw.currentMode.equals("Shader")) {
mc.mntsb_13.drawString(module.getLabel(), 3.39F, (float)(y + ClientHelper.mc.mntsb_18.getFontHeight() - 2), Color.WHITE.getRGB());
mc.mntsb_13.drawString("[on]", 90.29F, (float)(y + ClientHelper.mc.mntsb_18.getFontHeight() - 2), Color.WHITE.getRGB());
mc.mntsb_15.drawString(" KeyBinds", 18.39F, yPotionOffset - 1, Color.WHITE.getRGB());
RenderUtils.drawRect2(2.5, yPotionOffset -8, 101, 1F,ClientHelper.getClientColor().getRGB());
}
if (modw.currentMode.equals("New")) {
ClientHelper.mc.mntsb_18.drawString(module.getLabel().toLowerCase(), 4.0F, (float)(y + ClientHelper.mc.mntsb_18.getFontHeight() - 4), Color.WHITE.getRGB());
}
y += (int)(this.offsetY.getCurrentValue() * module.animYto);
GL11.glPopMatrix();
GLUtils.INSTANCE.rescaleMC();
}
}
}
}