From 3b02e08424672d57a5c316dfc66abaed4bf597cc Mon Sep 17 00:00:00 2001 From: ThisIsALegitUsername Date: Mon, 30 Jan 2023 23:40:55 +0000 Subject: [PATCH] Rounded option --- src/main/java/dev/resent/module/Theme.java | 43 ++++++++++++++++++- .../java/dev/resent/module/impl/hud/CPS.java | 2 +- .../resent/module/impl/hud/ComboCounter.java | 2 +- .../java/dev/resent/module/impl/hud/FPS.java | 2 +- .../dev/resent/module/impl/hud/Health.java | 2 +- .../java/dev/resent/module/impl/hud/Info.java | 12 +++--- .../java/dev/resent/module/impl/hud/Ping.java | 4 +- .../resent/module/impl/hud/PotCounter.java | 2 +- .../resent/module/impl/hud/ReachDisplay.java | 2 +- .../resent/module/impl/hud/ServerInfo.java | 2 +- .../dev/resent/module/impl/hud/Watermark.java | 2 +- .../java/dev/resent/module/impl/misc/HUD.java | 5 ++- .../resent/module/impl/movement/Sprint.java | 2 +- 13 files changed, 61 insertions(+), 21 deletions(-) diff --git a/src/main/java/dev/resent/module/Theme.java b/src/main/java/dev/resent/module/Theme.java index e34abe82..f466c1e2 100644 --- a/src/main/java/dev/resent/module/Theme.java +++ b/src/main/java/dev/resent/module/Theme.java @@ -1,5 +1,11 @@ package dev.resent.module; +import dev.resent.animation.Animation; +import dev.resent.animation.impl.DecelerateAnimation; +import dev.resent.animation.impl.EaseBackIn; +import dev.resent.animation.impl.EaseInOutQuad; +import dev.resent.animation.impl.ElasticAnimation; +import dev.resent.animation.impl.SmoothStepAnimation; import dev.resent.module.impl.misc.HUD; import dev.resent.util.render.RainbowUtil; @@ -19,8 +25,25 @@ public class Theme { return -1; } - public static int getId(){ - switch(HUD.theme.getValue()){ + public static Animation getAnimation(int id, int ms, int endpoint, float... etc){ + switch(id){ + case 1: + return new EaseBackIn(ms, endpoint, etc[0]); + case 2: + return new ElasticAnimation(ms, endpoint, etc[0], etc[1], false); + case 3: + return new EaseInOutQuad(ms, endpoint); + case 4: + return new DecelerateAnimation(ms, endpoint); + case 5: + return new SmoothStepAnimation(ms, endpoint); + } + + return null; + } + + public static int getFontId(){ + switch(HUD.fontTheme.getValue()){ case "Classic": return 1; case "Rainbow": @@ -30,6 +53,22 @@ public class Theme { return -1; } + public static int getAnimationId(){ + switch(HUD.animationTheme.getValue()){ + case "Ease back in": + return 1; + case "Elastic": + return 2; + case "Ease in out quad": + return 3; + case "Decelerate": + return 4; + case "Smooth step": + return 5; + } + return -1; + } + public static boolean getRounded(){ return HUD.round.getValue(); } diff --git a/src/main/java/dev/resent/module/impl/hud/CPS.java b/src/main/java/dev/resent/module/impl/hud/CPS.java index c2803315..d0733ffb 100644 --- a/src/main/java/dev/resent/module/impl/hud/CPS.java +++ b/src/main/java/dev/resent/module/impl/hud/CPS.java @@ -40,7 +40,7 @@ public class CPS extends RenderModule { final long time = System.currentTimeMillis(); FuncUtils.removeIf(clicks, aLong -> aLong + 1000 < time); - mc.fontRendererObj.drawString("[CPS: " + clicks.size() + "]", this.x+2, this.y+2, Theme.getFontColor(Theme.getId()), tshadow.getValue()); + mc.fontRendererObj.drawString("[CPS: " + clicks.size() + "]", this.x+2, this.y+2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); } } \ No newline at end of file diff --git a/src/main/java/dev/resent/module/impl/hud/ComboCounter.java b/src/main/java/dev/resent/module/impl/hud/ComboCounter.java index f23b2775..323a5850 100644 --- a/src/main/java/dev/resent/module/impl/hud/ComboCounter.java +++ b/src/main/java/dev/resent/module/impl/hud/ComboCounter.java @@ -44,6 +44,6 @@ public class ComboCounter extends RenderModule { if(Minecraft.getMinecraft().thePlayer.hurtTime > 3 && this.enabled){ combo = 0; } - Minecraft.getMinecraft().fontRendererObj.drawString("["+combo+" Combo]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId()), tshadow.getValue()); + Minecraft.getMinecraft().fontRendererObj.drawString("["+combo+" Combo]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); } } diff --git a/src/main/java/dev/resent/module/impl/hud/FPS.java b/src/main/java/dev/resent/module/impl/hud/FPS.java index 5d83d4c0..069465bb 100644 --- a/src/main/java/dev/resent/module/impl/hud/FPS.java +++ b/src/main/java/dev/resent/module/impl/hud/FPS.java @@ -32,7 +32,7 @@ public class FPS extends RenderModule { @Override public void draw() { if (mc.thePlayer != null) { - mc.fontRendererObj.drawString(getText(), this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId()), tshadow.getValue()); + mc.fontRendererObj.drawString(getText(), this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); } } } diff --git a/src/main/java/dev/resent/module/impl/hud/Health.java b/src/main/java/dev/resent/module/impl/hud/Health.java index 5f16c0ad..65b87d28 100644 --- a/src/main/java/dev/resent/module/impl/hud/Health.java +++ b/src/main/java/dev/resent/module/impl/hud/Health.java @@ -24,6 +24,6 @@ public class Health extends RenderModule { @Override public void draw() { - mc.fontRendererObj.drawString("[" + mc.thePlayer.getHealth() + " Health]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId()), tshadow.getValue()); + mc.fontRendererObj.drawString("[" + mc.thePlayer.getHealth() + " Health]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); } } diff --git a/src/main/java/dev/resent/module/impl/hud/Info.java b/src/main/java/dev/resent/module/impl/hud/Info.java index e7ba1ce2..90b42903 100644 --- a/src/main/java/dev/resent/module/impl/hud/Info.java +++ b/src/main/java/dev/resent/module/impl/hud/Info.java @@ -33,14 +33,14 @@ public class Info extends RenderModule { //int rot = MathHelper.floor_double(this.mc.thePlayer.rotationYaw*4/360+0.5) & 3; if (mc.thePlayer != null) { drawRect(this.x, this.y, this.x + this.getWidth(), this.y + this.getHeight(), new Color(0, 0, 0, 200).getRGB()); - mc.fontRendererObj.drawStringWithShadow(" X: " + px, this.x + 5, this.y + 14, Theme.getFontColor(Theme.getId())); - mc.fontRendererObj.drawStringWithShadow(" Y: " + py, this.x + 5, this.y + 24, Theme.getFontColor(Theme.getId())); - mc.fontRendererObj.drawStringWithShadow(" Z: " + pz, this.x + 5, this.y + 34, Theme.getFontColor(Theme.getId())); + mc.fontRendererObj.drawStringWithShadow(" X: " + px, this.x + 5, this.y + 14, Theme.getFontColor(Theme.getFontId())); + mc.fontRendererObj.drawStringWithShadow(" Y: " + py, this.x + 5, this.y + 24, Theme.getFontColor(Theme.getFontId())); + mc.fontRendererObj.drawStringWithShadow(" Z: " + pz, this.x + 5, this.y + 34, Theme.getFontColor(Theme.getFontId())); if (!direction.getValue()) yes = 6; //if (direction.getVtalue()) { - // mc.fontRendererObj.drawStringWithShadow(" Dir: " + Direction.directionsF[rot], this.x+5+mc.fontRendererObj.getStringWidth(" X: " + px), this.y + 14, Theme.getFontColor(Theme.getId())); - mc.fontRendererObj.drawStringWithShadow(" Biome: " + mc.theWorld.getBiomeGenForCoords(new BlockPos(px, py, pz)).biomeName, this.x + 5, this.y + 44, Theme.getFontColor(Theme.getId())); - //mc.fontRendererObj.drawStringWithShadow(" A: " + MathHelper.floor_double((double)mc.thePlayer.rotationYaw>360 || mc.thePlayer.rotationYaw<-360 ? mc.thePlayer.rotationYaw-360 : mc.thePlayer.rotationYaw) + "°", this.x + mc.fontRendererObj.getStringWidth(" D: N "), this.y + 44, Theme.getFontColor(Theme.getId())); + // mc.fontRendererObj.drawStringWithShadow(" Dir: " + Direction.directionsF[rot], this.x+5+mc.fontRendererObj.getStringWidth(" X: " + px), this.y + 14, Theme.getFontColor(Theme.getFontId())); + mc.fontRendererObj.drawStringWithShadow(" Biome: " + mc.theWorld.getBiomeGenForCoords(new BlockPos(px, py, pz)).biomeName, this.x + 5, this.y + 44, Theme.getFontColor(Theme.getFontId())); + //mc.fontRendererObj.drawStringWithShadow(" A: " + MathHelper.floor_double((double)mc.thePlayer.rotationYaw>360 || mc.thePlayer.rotationYaw<-360 ? mc.thePlayer.rotationYaw-360 : mc.thePlayer.rotationYaw) + "°", this.x + mc.fontRendererObj.getStringWidth(" D: N "), this.y + 44, Theme.getFontColor(Theme.getFontId())); yes = 7; //} diff --git a/src/main/java/dev/resent/module/impl/hud/Ping.java b/src/main/java/dev/resent/module/impl/hud/Ping.java index 89f2070e..01091b6d 100644 --- a/src/main/java/dev/resent/module/impl/hud/Ping.java +++ b/src/main/java/dev/resent/module/impl/hud/Ping.java @@ -18,12 +18,12 @@ public class Ping extends RenderModule { public void draw() { int ms = 0; if (mc.isSingleplayer()) { - ms = Theme.getFontColor(Theme.getId()); + ms = Theme.getFontColor(Theme.getFontId()); } ms = (int) mc.getCurrentServerData().pingToServer; this.setHeight(mc.fontRendererObj.FONT_HEIGHT + 4); this.setWidth(mc.fontRendererObj.getStringWidth("[" + ms + " ms]") + 4); - mc.fontRendererObj.drawString("[" + ms + " ms]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId()), tshadow.getValue()); + mc.fontRendererObj.drawString("[" + ms + " ms]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); } } diff --git a/src/main/java/dev/resent/module/impl/hud/PotCounter.java b/src/main/java/dev/resent/module/impl/hud/PotCounter.java index 0974a689..ff4e02d8 100644 --- a/src/main/java/dev/resent/module/impl/hud/PotCounter.java +++ b/src/main/java/dev/resent/module/impl/hud/PotCounter.java @@ -36,6 +36,6 @@ public class PotCounter extends RenderModule { } } - mc.fontRendererObj.drawString("[" + potinv + " Pots]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId()), tshadow.getValue()); + mc.fontRendererObj.drawString("[" + potinv + " Pots]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); } } diff --git a/src/main/java/dev/resent/module/impl/hud/ReachDisplay.java b/src/main/java/dev/resent/module/impl/hud/ReachDisplay.java index 575d5027..aace2370 100644 --- a/src/main/java/dev/resent/module/impl/hud/ReachDisplay.java +++ b/src/main/java/dev/resent/module/impl/hud/ReachDisplay.java @@ -27,7 +27,7 @@ public class ReachDisplay extends RenderModule { @Override public void draw() { - mc.fontRendererObj.drawStringWithShadow("[" + df2.format(range) + " Blocks]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId())); + mc.fontRendererObj.drawStringWithShadow("[" + df2.format(range) + " Blocks]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId())); } public void onAttack(Entity e){ diff --git a/src/main/java/dev/resent/module/impl/hud/ServerInfo.java b/src/main/java/dev/resent/module/impl/hud/ServerInfo.java index 7d427116..191c31f7 100644 --- a/src/main/java/dev/resent/module/impl/hud/ServerInfo.java +++ b/src/main/java/dev/resent/module/impl/hud/ServerInfo.java @@ -23,7 +23,7 @@ public class ServerInfo extends RenderModule { } public void draw() { - mc.fontRendererObj.drawString(getText(), this.x + 2, this.y + 2, Theme.getFontColor(Theme.getId()), tshadow.getValue()); + mc.fontRendererObj.drawString(getText(), this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); } public String getText() { diff --git a/src/main/java/dev/resent/module/impl/hud/Watermark.java b/src/main/java/dev/resent/module/impl/hud/Watermark.java index 9bb46c16..cef681fb 100644 --- a/src/main/java/dev/resent/module/impl/hud/Watermark.java +++ b/src/main/java/dev/resent/module/impl/hud/Watermark.java @@ -28,7 +28,7 @@ public class Watermark extends RenderModule { GlStateManager.scale(2f, 2f, 2f); int i = fr.drawString(Resent.NAME + " client", (this.x + 1) / 2, (this.y + 1) / 2, Color.RED.getRGB(), true); GlStateManager.scale(0.5f, 0.5f, 0.5f); - fr.drawString(Resent.VERSION + "", (i * 2), this.y + (fr.FONT_HEIGHT * 2 - 7), Theme.getFontColor(Theme.getId()), true); + fr.drawString(Resent.VERSION + "", (i * 2), this.y + (fr.FONT_HEIGHT * 2 - 7), Theme.getFontColor(Theme.getFontId()), true); GlStateManager.popMatrix(); } } diff --git a/src/main/java/dev/resent/module/impl/misc/HUD.java b/src/main/java/dev/resent/module/impl/misc/HUD.java index 1cbfd6be..18d41fce 100644 --- a/src/main/java/dev/resent/module/impl/misc/HUD.java +++ b/src/main/java/dev/resent/module/impl/misc/HUD.java @@ -8,11 +8,12 @@ import dev.resent.module.setting.ModeSetting; public class HUD extends Mod{ public HUD(){ super("Theme", Category.MISC, true); - addSetting(theme); + addSetting(fontTheme, animationTheme, round); } - public static final ModeSetting theme = new ModeSetting("Theme", "", "Classic", "Rainbow"); + public static final ModeSetting fontTheme = new ModeSetting("Font", "", "Classic", "Rainbow"); public static final BooleanSetting round = new BooleanSetting("Rounded", "", true); + public static final ModeSetting animationTheme = new ModeSetting("Animation", "", "Ease back in", "Ease in out quad", "Elastic", "Smooth step", "Decelerate"); //public static final BooleanSetting animated = new BooleanSetting("Animated", "", true); } diff --git a/src/main/java/dev/resent/module/impl/movement/Sprint.java b/src/main/java/dev/resent/module/impl/movement/Sprint.java index 6c6632af..f585b2fd 100644 --- a/src/main/java/dev/resent/module/impl/movement/Sprint.java +++ b/src/main/java/dev/resent/module/impl/movement/Sprint.java @@ -67,7 +67,7 @@ public class Sprint extends RenderModule { @Override public void draw() { this.fr = mc.fontRendererObj; - if (drawn.getValue()) fr.drawStringWithShadow(getText(), x + 2, y + 2, Theme.getFontColor(Theme.getId())); + if (drawn.getValue()) fr.drawStringWithShadow(getText(), x + 2, y + 2, Theme.getFontColor(Theme.getFontId())); } @Override