This commit is contained in:
UnknownUser1789 2023-01-18 14:06:49 +00:00
parent 00df7ca325
commit 60a1cb905d
5 changed files with 24135 additions and 24156 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,22 @@
package dev.resent.module.impl.hud;
import java.util.ArrayList;
import java.util.List;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.setting.BooleanSetting;
import dev.resent.util.misc.CPSUtils;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
public class CPS extends RenderModule {
private List<Long> clicksLMB = new ArrayList<Long>();
private List<Long> clicksRMB = new ArrayList<Long>();
private boolean wasPressedLMB;
private long lastPressedLMB;
private boolean wasPressedRMB;
private long lastPressedRMB;
public CPS() {
super("CPS", Category.HUD, 4, 84, true);
addSetting(tshadow);
@ -24,7 +34,43 @@ public class CPS extends RenderModule {
@Override
public void draw() {
mc.fontRendererObj.drawString("[" + CPSUtils.getLeftCPS()+CPSUtils.getRightCPS() + " CPS]", this.x + 2, this.y + 2, -1, tshadow.getValue());
mc.fontRendererObj.drawString(getText(), this.x + 2, this.y + 2, -1, tshadow.getValue());
}
public String getText(){
boolean pressedLMB = Keyboard.isKeyDown(mc.gameSettings.keyBindAttack.getKeyCode());
if(pressedLMB != this.wasPressedLMB) {
this.lastPressedLMB = System.currentTimeMillis();
this.wasPressedLMB = pressedLMB;
if(pressedLMB) {
this.clicksLMB.add(this.lastPressedLMB);
}
}
boolean pressedRMB = Keyboard.isKeyDown(mc.gameSettings.keyBindUseItem.getKeyCode());
if(pressedRMB != this.wasPressedRMB) {
this.lastPressedRMB = System.currentTimeMillis();
this.wasPressedRMB = pressedRMB;
if(pressedRMB) {
this.clicksRMB.add(this.lastPressedRMB);
}
}
return "[ " + getLMB() + " | " + getRMB() + " ]";
}
public int getLMB() {
final long time = System.currentTimeMillis();
this.clicksLMB.removeIf(aLong -> aLong + 1000 < time);
return this.clicksLMB.size();
}
public int getRMB() {
final long time = System.currentTimeMillis();
this.clicksRMB.removeIf(aLong -> aLong + 1000 < time);
return this.clicksRMB.size();
}
}

View File

@ -19,15 +19,13 @@ public class KeyStrokes extends RenderModule {
public KeyStrokes() {
super("Keystrokes", Category.HUD, 25, 4, true);
addSetting(chroma, sneak, transparent, lmbcps, rmbcps, tshadow, jump, color, colorp, gcolor, gcolorp, size);
addSetting(chroma, sneak, transparent, tshadow, jump, color, colorp, gcolor, gcolorp, size);
}
public BooleanSetting chroma = new BooleanSetting("Rainbow", "", false);
public BooleanSetting sneak = new BooleanSetting("Sneak", "", false);
public BooleanSetting jump = new BooleanSetting("Jump", "", true);
public BooleanSetting transparent = new BooleanSetting("Transparent", "", false);
public BooleanSetting lmbcps = new BooleanSetting("LMB cps counter", "", true);
public BooleanSetting rmbcps = new BooleanSetting("RMB cps counter", "", true);
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");
@ -35,22 +33,6 @@ public class KeyStrokes extends RenderModule {
public ModeSetting gcolor = new ModeSetting("Pressed button color", "", "White", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "Black");
public ModeSetting gcolorp = new ModeSetting("Unpressed button color", "", "Black", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "White");
public boolean wKey = Keyboard.isKeyDown(mc.gameSettings.keyBindForward.getKeyCode());
public boolean aKey = Keyboard.isKeyDown(mc.gameSettings.keyBindLeft.getKeyCode());
public boolean sKey = Keyboard.isKeyDown(mc.gameSettings.keyBindBack.getKeyCode());
public boolean dKey = Keyboard.isKeyDown(mc.gameSettings.keyBindRight.getKeyCode());
public boolean spaceKey = Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode());
public boolean pressed = Keyboard.isKeyDown(mc.gameSettings.keyBindAttack.getKeyCode());
public boolean rpressed = Keyboard.isKeyDown(mc.gameSettings.keyBindUseItem.getKeyCode());
public int getColor(int id, int opacity){
if(id == 1){
}
return -1;
}
public float getSize(ModeSetting size) {
if (size.getValue() == "Small") return 0.75f;
if (size.getValue() == "Normal") return 1.0f;
@ -61,6 +43,14 @@ public class KeyStrokes extends RenderModule {
@Override
public void draw() {
boolean wKey = Keyboard.isKeyDown(mc.gameSettings.keyBindForward.getKeyCode());
boolean aKey = Keyboard.isKeyDown(mc.gameSettings.keyBindLeft.getKeyCode());
boolean sKey = Keyboard.isKeyDown(mc.gameSettings.keyBindBack.getKeyCode());
boolean dKey = Keyboard.isKeyDown(mc.gameSettings.keyBindRight.getKeyCode());
boolean spaceKey = Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode());
boolean pressed = Keyboard.isKeyDown(mc.gameSettings.keyBindAttack.getKeyCode());
boolean rpressed = Keyboard.isKeyDown(mc.gameSettings.keyBindUseItem.getKeyCode());
GlStateManager.pushMatrix();
GlStateManager.translate(this.x + 1, this.y + 1, 0);
@ -98,18 +88,6 @@ public class KeyStrokes extends RenderModule {
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) ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
GlStateManager.popMatrix();
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);
GlStateManager.translate(this.x + 41, this.y + 82, 0);
GlStateManager.scale(0.5f, 0.5f, 0);
GlStateManager.translate(-(this.x + 41), -(this.y + 82), 0);
if (lmbcps.getValue()) mc.fontRendererObj.drawString(CPSUtils.getLeftCPS() + " CPS", this.x - 10, this.y + 72, Mouse.isButtonDown(0) ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
if (rmbcps.getValue()) mc.fontRendererObj.drawString(CPSUtils.getRightCPS() + " CPS", this.x + 70, this.y + 72, Mouse.isButtonDown(1) ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(this.x + 1, this.y + 1, 0);
GlStateManager.translate(-(this.x + 1), -(this.y + 1), 0);

View File

@ -1,49 +0,0 @@
package dev.resent.util.misc;
import java.util.ArrayList;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.minecraft.client.Minecraft;
public class CPSUtils {
public static List<Long> clicks = new ArrayList<>();
public static List<Long> clicks2 = new ArrayList<>();
public static boolean pressed = Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode());
public static boolean rpressed = Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode());
public static boolean wasPressed;
public static boolean wasPressed2;
public static long lastPressed;
public static long lastPressed2;
public static int getLeftCPS() {
updateCPS();
final long leftTime = System.currentTimeMillis() + 100L;
FuncUtils.removeIf(clicks, beenLeftTime -> beenLeftTime + 1200L < leftTime + 200L);
return clicks.size();
}
public static int getRightCPS() {
updateCPS();
final long rightTime = System.currentTimeMillis() + 100L;
FuncUtils.removeIf(clicks2, beenRightTime -> beenRightTime + 1200L < rightTime + 200L);
return clicks2.size();
}
public static void updateCPS(){
if (pressed != wasPressed) {
lastPressed = System.currentTimeMillis();
wasPressed = pressed;
if (pressed) clicks.add(Long.valueOf(lastPressed));
}
if (rpressed != wasPressed2) {
lastPressed2 = System.currentTimeMillis() + 10L;
wasPressed2 = rpressed;
if (rpressed) clicks2.add(Long.valueOf(lastPressed2));
}
}
}