Add a cps utils class.

This commit is contained in:
UnknownUser1789 2023-01-18 03:57:27 +00:00
parent 964ff6d942
commit 00df7ca325
45 changed files with 30513 additions and 30460 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

6
pack.mcmeta Normal file
View File

@ -0,0 +1,6 @@
{
"pack": {
"pack_format": 1,
"description": "Arial x256 with unicode"
}
}

View File

@ -1,5 +1,8 @@
package dev.resent.module.base;
import java.util.ArrayList;
import java.util.List;
import dev.resent.module.impl.hud.ArmorHud;
import dev.resent.module.impl.hud.CPS;
import dev.resent.module.impl.hud.ComboCounter;
@ -33,8 +36,6 @@ import dev.resent.module.impl.misc.Scoreboard;
import dev.resent.module.impl.misc.SelfNametag;
import dev.resent.module.impl.misc.Tooltips;
import dev.resent.module.impl.movement.Sprint;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
public class ModManager {

View File

@ -3,10 +3,7 @@ package dev.resent.module.impl.hud;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.setting.BooleanSetting;
import dev.resent.util.misc.FuncUtils;
import java.util.ArrayList;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import dev.resent.util.misc.CPSUtils;
public class CPS extends RenderModule {
@ -15,10 +12,6 @@ public class CPS extends RenderModule {
addSetting(tshadow);
}
private final List<Long> clicks = new ArrayList<>();
private boolean wasPressed;
private long lastPressed;
public BooleanSetting tshadow = new BooleanSetting("Text shadow", "", true);
public int getWidth() {
@ -31,19 +24,7 @@ public class CPS extends RenderModule {
@Override
public void draw() {
final boolean pressed = Mouse.isButtonDown(0) || Mouse.isButtonDown(1);
if (pressed != wasPressed) {
lastPressed = System.currentTimeMillis();
wasPressed = pressed;
if (pressed) {
this.clicks.add(lastPressed);
}
}
final long time = System.currentTimeMillis();
FuncUtils.removeIf(clicks, aLong -> aLong + 1000 < time);
mc.fontRendererObj.drawString("[" + clicks.size() + " CPS]", this.x + 2, this.y + 2, -1, tshadow.getValue());
mc.fontRendererObj.drawString("[" + CPSUtils.getLeftCPS()+CPSUtils.getRightCPS() + " CPS]", this.x + 2, this.y + 2, -1, tshadow.getValue());
}
}

View File

@ -4,18 +4,16 @@ import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.setting.BooleanSetting;
import dev.resent.setting.ModeSetting;
import dev.resent.util.misc.FuncUtils;
import dev.resent.util.misc.CPSUtils;
import dev.resent.util.render.RainbowUtil;
import dev.resent.util.render.RenderUtils;
import java.util.ArrayList;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
public class KeyStrokes extends RenderModule {
public static KeyStrokes INSTANCE = new KeyStrokes();
private final Minecraft mc = Minecraft.getMinecraft();
@ -26,8 +24,8 @@ public class KeyStrokes extends RenderModule {
public BooleanSetting chroma = new BooleanSetting("Rainbow", "", false);
public BooleanSetting sneak = new BooleanSetting("Sneak", "", false);
public BooleanSetting transparent = new BooleanSetting("Transparent", "", 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);
@ -36,12 +34,22 @@ public class KeyStrokes extends RenderModule {
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 gcolorp = new ModeSetting("Unpressed button color", "", "Black", "Red", "Yellow", "Green", "Blue", "Pink", "Orange", "White");
public List<Long> clicks = new ArrayList<>();
public boolean wasPressed;
public long lastPressed;
private final List<Long> clicks2 = new ArrayList<>();
public boolean wasPressed2;
public long lastPressed2;
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;
@ -50,32 +58,8 @@ public class KeyStrokes extends RenderModule {
return 1.0f;
}
public int getLeftCPS() {
final long leftTime = System.currentTimeMillis() + 100L;
FuncUtils.removeIf(clicks, beenLeftTime -> beenLeftTime + 1200L < leftTime + 200L);
return this.clicks.size();
}
public int getRightCPS() {
final long rightTime = System.currentTimeMillis() + 100L;
FuncUtils.removeIf(clicks2, beenRightTime -> beenRightTime + 1200L < rightTime + 200L);
return this.clicks2.size();
}
@Override
public void draw() {
boolean pressed = mc.gameSettings.keyBindAttack.pressed;
boolean rpressed = mc.gameSettings.keyBindUseItem.pressed;
if (pressed != this.wasPressed) {
this.lastPressed = System.currentTimeMillis();
this.wasPressed = pressed;
if (pressed) this.clicks.add(Long.valueOf(this.lastPressed));
}
if (rpressed != this.wasPressed2) {
this.lastPressed2 = System.currentTimeMillis() + 10L;
this.wasPressed2 = rpressed;
if (rpressed) this.clicks2.add(Long.valueOf(this.lastPressed2));
}
GlStateManager.pushMatrix();
@ -85,33 +69,34 @@ public class KeyStrokes extends RenderModule {
if (!transparent.getValue()) {
//W
Gui.drawRect(this.x + 30, this.y + 3, this.x + 55, this.y + 25 + 3, mc.gameSettings.keyBindForward.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 30, this.y + 3, this.x + 55, this.y + 25 + 3, wKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// S
Gui.drawRect(this.x + 30, this.y + 30, this.x + 55, this.y + 55, mc.gameSettings.keyBindBack.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 30, this.y + 30, this.x + 55, this.y + 55, sKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// A
Gui.drawRect(this.x + 3, this.y + 30, this.x + 25 + 3, this.y + 55, mc.gameSettings.keyBindLeft.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 3, this.y + 30, this.x + 25 + 3, this.y + 55, aKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// D
Gui.drawRect(this.x + 60 - 3, this.y + 30, this.x + 85 - 3, this.y + 25 + 5 + 25, mc.gameSettings.keyBindRight.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 60 - 3, this.y + 30, this.x + 85 - 3, this.y + 25 + 5 + 25, dKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// LMB
Gui.drawRect(this.x + 3, this.y + 57, this.x + 41, this.y + 82, mc.gameSettings.keyBindAttack.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 3, this.y + 57, this.x + 41, this.y + 82, pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// RMB
Gui.drawRect(this.x + 45 - 1, this.y + 60 - 3, this.x + 85 - 3, this.y + 85 - 3, mc.gameSettings.keyBindUseItem.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
Gui.drawRect(this.x + 45 - 1, this.y + 60 - 3, this.x + 85 - 3, this.y + 85 - 3, rpressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// Jump
if (jump.getValue()) Gui.drawRect(this.x + 3, this.y + 84, this.x + 85 - 3, this.y + 105 - 6, mc.gameSettings.keyBindJump.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
if (jump.getValue()) Gui.drawRect(this.x + 3, this.y + 84, this.x + 85 - 3, this.y + 105 - 6, spaceKey ? RenderUtils.getColor(gcolor) : RenderUtils.getColor(gcolorp));
// Sneak
if (sneak.getValue()) Gui.drawRect(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, mc.gameSettings.keyBindSneak.pressed ? RenderUtils.getColor(gcolor) : RenderUtils.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) : mc.gameSettings.keyBindForward.pressed ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
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) : mc.gameSettings.keyBindBack.pressed ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
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) : mc.gameSettings.keyBindLeft.pressed ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
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) : mc.gameSettings.keyBindRight.pressed ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.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) : mc.gameSettings.keyBindJump.pressed ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color)), tshadow.getValue());
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 ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
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 ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
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 ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
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 ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.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) : spaceKey ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color)), tshadow.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 ? RenderUtils.getColor(colorp) : RenderUtils.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, chroma.getValue() ? RainbowUtil.getRainbow(4f, 0.8f, 0.85f) : Mouse.isButtonDown(0) ? RenderUtils.getColor(colorp) : RenderUtils.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, 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);
@ -121,8 +106,8 @@ public class KeyStrokes extends RenderModule {
GlStateManager.scale(0.5f, 0.5f, 0);
GlStateManager.translate(-(this.x + 41), -(this.y + 82), 0);
if (lmbcps.getValue()) mc.fontRendererObj.drawString(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(getRightCPS() + " CPS", this.x + 70, this.y + 72, Mouse.isButtonDown(1) ? RenderUtils.getColor(colorp) : RenderUtils.getColor(color), tshadow.getValue());
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();
@ -133,4 +118,5 @@ public class KeyStrokes extends RenderModule {
GlStateManager.popMatrix();
}
}

View File

@ -4,11 +4,13 @@ import java.io.IOException;
import dev.resent.Resent;
import dev.resent.animation.Animation;
import dev.resent.animation.Direction;
import dev.resent.animation.impl.EaseBackIn;
import dev.resent.module.base.Mod;
import dev.resent.setting.BooleanSetting;
import dev.resent.setting.ModeSetting;
import dev.resent.setting.Setting;
import dev.resent.util.misc.GlUtils;
import dev.resent.util.render.Color;
import dev.resent.util.render.RenderUtils;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
@ -30,6 +32,7 @@ public class ClickGUI extends GuiScreen {
public int x, y, width, height;
public int offset = 0;
public FontRenderer fr;
public boolean close = false;
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
@ -98,13 +101,6 @@ public class ClickGUI extends GuiScreen {
}
}
public static void startScale(float x, float y, float scale) {
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
GlStateManager.scale(scale, scale, 1);
GlStateManager.translate(-x, -y, 0);
}
@Override
public void drawScreen(int mouseX, int mouseY, float par3) {
sr = new ScaledResolution(mc);
@ -119,7 +115,14 @@ public class ClickGUI extends GuiScreen {
y = sr.getScaledHeight() - 10 + xy;
int off = 0;
startScale(((this.x) + (this.x + this.width)) / 2, ((this.y) + (this.y + this.height)) / 2, (float) introAnimation.getValue());
if(close) {
introAnimation.setDirection(Direction.BACKWARDS);
if(introAnimation.isDone(Direction.BACKWARDS)) {
mc.displayGuiScreen(null);
}
}
GlUtils.startScale(((this.x) + (this.x + this.width)) / 2, ((this.y) + (this.y + this.height)) / 2, (float) introAnimation.getValue());
// background
Gui.drawRect(x - 10, y + 20, width + 35, height - 10, new Color(35, 39, 42, 200).getRGB());
@ -139,10 +142,9 @@ public class ClickGUI extends GuiScreen {
// RenderUtils.drawRectOutline(width+15, height-5, width+26, height+8, new Color(200, 200, 200, 90).getRGB());
fr.drawString("X", width + 18, height - 2, -1);
GlUtils.stopScale();
// white line
Gui.drawRect(x - 8, height + 29, width + 33, height + 30, -1);
GlStateManager.popMatrix();
for (Mod m : Resent.INSTANCE.modManager.modules) {
if (this.modWatching == null) {
int fh = fr.FONT_HEIGHT;
@ -259,7 +261,7 @@ public class ClickGUI extends GuiScreen {
protected void keyTyped(char par1, int par2) {
if (par2 == 0x01 || par2 == Minecraft.getMinecraft().gameSettings.keyBindClickGui.keyCode) {
mc.displayGuiScreen(null);
close = true;
}
}

View File

@ -0,0 +1,5 @@
package dev.resent.util;
public class Theme {
}

View File

@ -0,0 +1,49 @@
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));
}
}
}

View File

@ -0,0 +1,19 @@
package dev.resent.util.misc;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
public class GlUtils {
public static void startScale(float x, float y, float scale) {
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
GlStateManager.scale(scale, scale, 1);
GlStateManager.translate(-x, -y, 0);
}
public static void stopScale(){
GlStateManager.popMatrix();
}
}

View File

@ -102,7 +102,7 @@ public class Gui {
* specified colors (ARGB format). Args : x1, y1, x2, y2,
* topColor, bottomColor
*/
protected void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) {
public void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor) {
float f = (float) (startColor >> 24 & 255) / 255.0F;
float f1 = (float) (startColor >> 16 & 255) / 255.0F;
float f2 = (float) (startColor >> 8 & 255) / 255.0F;