optimize keystrokes

This commit is contained in:
ThisIsALegitUsername 2023-02-01 00:03:44 +00:00
parent efaff67e00
commit 090a6855f0
3 changed files with 30682 additions and 30710 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -3,17 +3,15 @@ package dev.resent.module.impl.hud;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
//import dev.resent.animation.SimpleAnimation; import dev.resent.module.Theme;
import dev.resent.module.base.Category; import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule; import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting; import dev.resent.module.setting.BooleanSetting;
import dev.resent.module.setting.ModeSetting; import dev.resent.module.setting.ModeSetting;
import dev.resent.util.misc.FuncUtils; import dev.resent.util.misc.FuncUtils;
import dev.resent.util.render.Color; import dev.resent.util.render.Color;
import dev.resent.util.render.RainbowUtil;
import dev.resent.util.render.RenderUtils; import dev.resent.util.render.RenderUtils;
import net.lax1dude.eaglercraft.v1_8.Mouse; import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
public class KeyStrokes extends RenderModule{ public class KeyStrokes extends RenderModule{
@ -23,15 +21,12 @@ public class KeyStrokes extends RenderModule{
public KeyStrokes(){ public KeyStrokes(){
super("Keystrokes", Category.HUD, 25, 4, true); super("Keystrokes", Category.HUD, 25, 4, true);
addSetting(chroma, sneak, transparent, tshadow, jump, color, colorp, gcolor, gcolorp, size); addSetting(sneak, tshadow, jump, color, colorp, gcolor, gcolorp);
} }
public BooleanSetting chroma = new BooleanSetting("Rainbow", "", false);
public BooleanSetting sneak = new BooleanSetting("Sneak", "", false); public BooleanSetting sneak = new BooleanSetting("Sneak", "", false);
public BooleanSetting transparent = new BooleanSetting("Transparent", "", false);
public BooleanSetting jump = new BooleanSetting("Jump", "", true); public BooleanSetting jump = new BooleanSetting("Jump", "", true);
public BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", false); public BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", false);
public ModeSetting size = new ModeSetting("Size", "", "Small", "Normal", "Large");
public ModeSetting color = new ModeSetting("Unpressed text color", "", "White", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "Black"); public ModeSetting color = new ModeSetting("Unpressed text color", "", "White", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "Black");
public ModeSetting colorp = new ModeSetting("Pressed text color", "", "Black", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "White"); public ModeSetting colorp = new ModeSetting("Pressed text color", "", "Black", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "White");
public ModeSetting gcolor = new ModeSetting("Pressed button color", "", "White", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "Black"); public ModeSetting gcolor = new ModeSetting("Pressed button color", "", "White", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "Black");
@ -96,13 +91,6 @@ public class KeyStrokes extends RenderModule{
this.clicks2.add(Long.valueOf(this.lastPressed2)); this.clicks2.add(Long.valueOf(this.lastPressed2));
} }
GlStateManager.pushMatrix();
GlStateManager.translate(this.x + 1, this.y + 1, 0);
GlStateManager.scale(getSize(this.size), getSize(this.size), getSize(this.size));
GlStateManager.translate(-(this.x + 1), -(this.y + 1), 0);
if (!transparent.getValue()) {
//W //W
RenderUtils.drawRoundedRect(this.x + 30, this.y + 3, this.x + 55, this.y + 25 + 3, 4, RenderUtils.drawRoundedRect(this.x + 30, this.y + 3, this.x + 55, this.y + 25 + 3, 4,
wKey ? getColor(gcolor) : getColor(gcolorp)); wKey ? getColor(gcolor) : getColor(gcolorp));
@ -126,32 +114,25 @@ public class KeyStrokes extends RenderModule{
if(jump.getValue()) if(jump.getValue())
RenderUtils.drawRoundedRect(this.x + 3, this.y+84, this.x+85-3, RenderUtils.drawRoundedRect(this.x + 3, this.y+84, this.x+85-3,
this.y + 105 - 6, 4, jumpKey ? getColor(gcolor) : getColor(gcolorp)); this.y + 105 - 6, 4, jumpKey ? getColor(gcolor) : getColor(gcolorp));
}
// Sneak // Sneak
if (sneak.getValue() && !transparent.getValue()) if (sneak.getValue())
RenderUtils.drawRoundedRect(this.x + 3, jump.getValue() ? this.y+102 : this.y+84, this.x+85-3, RenderUtils.drawRoundedRect(this.x + 3, jump.getValue() ? this.y+102 : this.y+84, this.x+85-3,
jump.getValue() ? this.y+120-3 : this.y+105-6, 4, mc.gameSettings.keyBindSneak.pressed ? getColor(gcolor) : getColor(gcolorp)); jump.getValue() ? this.y+120-3 : this.y+105-6, 4, mc.gameSettings.keyBindSneak.pressed ? getColor(gcolor) : getColor(gcolorp));
mc.fontRendererObj.drawString("W", this.x+25+5+(25/2-mc.fontRendererObj.getStringWidth("W") + 4), this.y+8+3, chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : wKey ? getColor(colorp) : getColor(color), tshadow.getValue()); mc.fontRendererObj.drawString("W", this.x+25+5+(25/2-mc.fontRendererObj.getStringWidth("W") + 4), this.y+8+3, wKey ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("S", this.x+25+5+(25/2-mc.fontRendererObj.getStringWidth("S") + 4), this.y+38, chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : sKey ? getColor(colorp) : getColor(color), tshadow.getValue()); mc.fontRendererObj.drawString("S", this.x+25+5+(25/2-mc.fontRendererObj.getStringWidth("S") + 4), this.y+38, sKey ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("A", this.x+3+(25/2-mc.fontRendererObj.getStringWidth("A") + 4), this.y+38, chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : aKey ? getColor(colorp) : getColor(color), tshadow.getValue()); mc.fontRendererObj.drawString("A", this.x+3+(25/2-mc.fontRendererObj.getStringWidth("A") + 4), this.y+38, aKey ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("D", this.x+-3+25+25+10+(25/2-mc.fontRendererObj.getStringWidth("D") + 4), this.y+38, chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : dKey ? getColor(colorp) : getColor(color), tshadow.getValue()); mc.fontRendererObj.drawString("D", this.x+-3+25+25+10+(25/2-mc.fontRendererObj.getStringWidth("D") + 4), this.y+38, dKey ? getColor(colorp) : getColor(color), Theme.getTextShadow());
if(jump.getValue()) if(jump.getValue())
mc.fontRendererObj.drawString("\u00A7m-------", this.x+85+(25/2-mc.fontRendererObj.getStringWidth("u00A7m-------") + 4), this.y+92-3, (chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : jumpKey ? getColor(colorp) : getColor(color)), tshadow.getValue()); mc.fontRendererObj.drawString("\u00A7m-------", this.x+85+(25/2-mc.fontRendererObj.getStringWidth("u00A7m-------") + 4), this.y+92-3, jumpKey ? getColor(colorp) : getColor(color), Theme.getTextShadow());
if(sneak.getValue()) if(sneak.getValue())
mc.fontRendererObj.drawString("Sneak", this.x+38+3+(25/2-mc.fontRendererObj.getStringWidth("Sneak") + 4), jump.getValue() ? this.y+92+15+1-3 : this.y+92-4, (chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : mc.gameSettings.keyBindSneak.pressed ? getColor(colorp) : getColor(color)), tshadow.getValue()); mc.fontRendererObj.drawString("Sneak", this.x+38+3+(25/2-mc.fontRendererObj.getStringWidth("Sneak") + 4), jump.getValue() ? this.y+92+15+1-3 : this.y+92-4, mc.gameSettings.keyBindSneak.pressed ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("LMB", this.x+3+40/2-mc.fontRendererObj.getStringWidth("LMB")/2, (this.y+60+25/2)-mc.fontRendererObj.FONT_HEIGHT/2-3, chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : Mouse.isButtonDown(0) ? getColor(colorp) : getColor(color), tshadow.getValue()); mc.fontRendererObj.drawString("LMB", this.x+3+40/2-mc.fontRendererObj.getStringWidth("LMB")/2, (this.y+60+25/2)-mc.fontRendererObj.FONT_HEIGHT/2-3, Mouse.isButtonDown(0) ? getColor(colorp) : getColor(color), Theme.getTextShadow());
mc.fontRendererObj.drawString("RMB", this.x+40+3+40/2-mc.fontRendererObj.getStringWidth("RMB")/2, (this.y+60+25/2)-mc.fontRendererObj.FONT_HEIGHT/2-3, chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : Mouse.isButtonDown(1) ? getColor(colorp) : getColor(color), tshadow.getValue()); mc.fontRendererObj.drawString("RMB", this.x+40+3+40/2-mc.fontRendererObj.getStringWidth("RMB")/2, (this.y+60+25/2)-mc.fontRendererObj.FONT_HEIGHT/2-3, Mouse.isButtonDown(1) ? getColor(colorp) : getColor(color), Theme.getTextShadow());
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.x + 1, this.y + 1, 0);
GlStateManager.translate(-(this.x + 1), -(this.y + 1), 0);
this.setHeight((25 + 5 + 25 + 5 + 25 + 25)); this.setHeight((25 + 5 + 25 + 5 + 25 + 25));
this.setWidth((25 + 5 + 25 + 5 + 30)); this.setWidth((25 + 5 + 25 + 5 + 30));
GlStateManager.popMatrix();
} }
public static int getColor(ModeSetting asdf) { public static int getColor(ModeSetting asdf) {