Universal text shadow option

This commit is contained in:
ThisIsALegitUsername 2023-01-31 00:41:01 +00:00
parent 5fd5d66583
commit 1bd1f6d85c
17 changed files with 29894 additions and 29899 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -48,7 +48,8 @@ public class Theme {
return 1; return 1;
case "Rainbow": case "Rainbow":
return 50; return 50;
case "Chroma":
return 6942069;
} }
return -1; return -1;
} }
@ -72,5 +73,9 @@ public class Theme {
public static boolean getRounded(){ public static boolean getRounded(){
return HUD.round.getValue(); return HUD.round.getValue();
} }
public static boolean getTextShadow(){
return HUD.tshadow.getValue();
}
} }

View File

@ -57,6 +57,16 @@ public class Mod {
} }
} }
protected int drawString(String text, int x, int y, int color, boolean idk){
if(color == 6942069){
RenderUtils.drawChromaString(text, x, y, idk);
}else {
Minecraft.getMinecraft().fontRendererObj.drawString(text, x, y, color, idk);
}
return x;
}
public void setEnabled(boolean state) { public void setEnabled(boolean state) {
this.enabled = state; this.enabled = state;
if (this.enabled) onEnable(); else onDisable(); if (this.enabled) onEnable(); else onDisable();

View File

@ -6,21 +6,18 @@ import java.util.List;
import dev.resent.module.Theme; 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.util.misc.FuncUtils; import dev.resent.util.misc.FuncUtils;
public class CPS extends RenderModule { public class CPS extends RenderModule {
public CPS() { public CPS() {
super("CPS", Category.HUD, 50, 4, true); super("CPS", Category.HUD, 50, 4, true);
addSetting(tshadow);
} }
private List<Long> clicks = new ArrayList<>(); private List<Long> clicks = new ArrayList<>();
private boolean wasPressed; private boolean wasPressed;
private long lastPressed; private long lastPressed;
public BooleanSetting tshadow = new BooleanSetting("Text shadow", "", true);
public int getWidth() { return mc.fontRendererObj.getStringWidth("[CPS: "+ clicks.size() + "]") + 4; } public int getWidth() { return mc.fontRendererObj.getStringWidth("[CPS: "+ clicks.size() + "]") + 4; }
public int getHeight() { return mc.fontRendererObj.FONT_HEIGHT+4; } public int getHeight() { return mc.fontRendererObj.FONT_HEIGHT+4; }
@ -40,7 +37,7 @@ public class CPS extends RenderModule {
final long time = System.currentTimeMillis(); final long time = System.currentTimeMillis();
FuncUtils.removeIf(clicks, aLong -> aLong + 1000 < time); FuncUtils.removeIf(clicks, aLong -> aLong + 1000 < time);
mc.fontRendererObj.drawString("[CPS: " + clicks.size() + "]", this.x+2, this.y+2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); drawString("[CPS: " + clicks.size() + "]", this.x+2, this.y+2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
} }
} }

View File

@ -3,7 +3,6 @@ package dev.resent.module.impl.hud;
import dev.resent.module.Theme; 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 net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.network.play.server.S19PacketEntityStatus; import net.minecraft.network.play.server.S19PacketEntityStatus;
@ -12,12 +11,10 @@ public class ComboCounter extends RenderModule {
public ComboCounter() { public ComboCounter() {
super("ComboCounter", Category.HUD, 4, 24, true); super("ComboCounter", Category.HUD, 4, 24, true);
addSetting(tshadow);
} }
public static boolean attacked = false; public static boolean attacked = false;
public static int combo = 0; public static int combo = 0;
public static BooleanSetting tshadow = new BooleanSetting("Text shadow", "", true);
public void onAttack(Entity e) { public void onAttack(Entity e) {
if (this.isEnabled()) { if (this.isEnabled()) {
@ -44,6 +41,6 @@ public class ComboCounter extends RenderModule {
if(Minecraft.getMinecraft().thePlayer.hurtTime > 3 && this.enabled){ if(Minecraft.getMinecraft().thePlayer.hurtTime > 3 && this.enabled){
combo = 0; combo = 0;
} }
Minecraft.getMinecraft().fontRendererObj.drawString("["+combo+" Combo]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); Minecraft.getMinecraft().fontRendererObj.drawString("["+combo+" Combo]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
} }
} }

View File

@ -3,7 +3,6 @@ package dev.resent.module.impl.hud;
import dev.resent.module.Theme; 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 net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
public class FPS extends RenderModule { public class FPS extends RenderModule {
@ -12,11 +11,8 @@ public class FPS extends RenderModule {
public FPS() { public FPS() {
super("FPS", Category.HUD, 4, 14, true); super("FPS", Category.HUD, 4, 14, true);
addSetting(tshadow);
} }
public BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", true);
public int getWidth() { public int getWidth() {
return mc.fontRendererObj.getStringWidth(getText()) + 4; return mc.fontRendererObj.getStringWidth(getText()) + 4;
} }
@ -32,7 +28,7 @@ public class FPS extends RenderModule {
@Override @Override
public void draw() { public void draw() {
if (mc.thePlayer != null) { if (mc.thePlayer != null) {
mc.fontRendererObj.drawString(getText(), this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); drawString(getText(), this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
} }
} }
} }

View File

@ -3,17 +3,13 @@ package dev.resent.module.impl.hud;
import dev.resent.module.Theme; 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;
public class Health extends RenderModule { public class Health extends RenderModule {
public Health() { public Health() {
super("Health Display", Category.HUD, 4, 64, true); super("Health Display", Category.HUD, 4, 64, true);
addSetting(tshadow);
} }
public BooleanSetting tshadow = new BooleanSetting("Text shadow", "", true);
public int getHeight() { public int getHeight() {
return mc.fontRendererObj.FONT_HEIGHT + 4; return mc.fontRendererObj.FONT_HEIGHT + 4;
} }
@ -24,6 +20,6 @@ public class Health extends RenderModule {
@Override @Override
public void draw() { public void draw() {
mc.fontRendererObj.drawString("[" + mc.thePlayer.getHealth() + " Health]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); drawString("[" + mc.thePlayer.getHealth() + " Health]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
} }
} }

View File

@ -33,14 +33,14 @@ public class Info extends RenderModule {
//int rot = MathHelper.floor_double(this.mc.thePlayer.rotationYaw*4/360+0.5) & 3; //int rot = MathHelper.floor_double(this.mc.thePlayer.rotationYaw*4/360+0.5) & 3;
if (mc.thePlayer != null) { if (mc.thePlayer != null) {
drawRect(this.x, this.y, this.x + this.getWidth(), this.y + this.getHeight(), new Color(0, 0, 0, 200).getRGB()); 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.getFontId())); drawString(" X: " + px, this.x + 5, this.y + 14, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
mc.fontRendererObj.drawStringWithShadow(" Y: " + py, this.x + 5, this.y + 24, Theme.getFontColor(Theme.getFontId())); drawString(" Y: " + py, this.x + 5, this.y + 24, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
mc.fontRendererObj.drawStringWithShadow(" Z: " + pz, this.x + 5, this.y + 34, Theme.getFontColor(Theme.getFontId())); drawString(" Z: " + pz, this.x + 5, this.y + 34, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
if (!direction.getValue()) yes = 6; if (!direction.getValue()) yes = 6;
//if (direction.getVtalue()) { //if (direction.getVtalue()) {
// mc.fontRendererObj.drawStringWithShadow(" Dir: " + Direction.directionsF[rot], this.x+5+mc.fontRendererObj.getStringWidth(" X: " + px), this.y + 14, Theme.getFontColor(Theme.getFontId())); // drawStringWithShadow(" Dir: " + Direction.directionsF[rot], this.x+5+mc.fontRendererObj.getStringWidth(" X: " + px), this.y + 14, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
mc.fontRendererObj.drawStringWithShadow(" Biome: " + mc.theWorld.getBiomeGenForCoords(new BlockPos(px, py, pz)).biomeName, this.x + 5, this.y + 44, Theme.getFontColor(Theme.getFontId())); drawString(" Biome: " + mc.theWorld.getBiomeGenForCoords(new BlockPos(px, py, pz)).biomeName, this.x + 5, this.y + 44, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
//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())); //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()), Theme.getTextShadow());
yes = 7; yes = 7;
//} //}

View File

@ -3,27 +3,24 @@ package dev.resent.module.impl.hud;
import dev.resent.module.Theme; 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;
public class Ping extends RenderModule { public class Ping extends RenderModule {
public Ping() { public Ping() {
super("Ping Display", Category.HUD, 4, 54, true); super("Ping Display", Category.HUD, 4, 54, true);
addSetting(tshadow);
} }
public BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", true);
@Override @Override
public void draw() { public void draw() {
int ms = 0; int ms = 0;
if (mc.isSingleplayer()) { if (mc.isSingleplayer()) {
ms = Theme.getFontColor(Theme.getFontId()); ms = -1;
} }
ms = (int) mc.getCurrentServerData().pingToServer; ms = (int) mc.getCurrentServerData().pingToServer;
this.setHeight(mc.fontRendererObj.FONT_HEIGHT + 4); this.setHeight(mc.fontRendererObj.FONT_HEIGHT + 4);
this.setWidth(mc.fontRendererObj.getStringWidth("[" + ms + " ms]") + 4); this.setWidth(mc.fontRendererObj.getStringWidth("[" + ms + " ms]") + 4);
mc.fontRendererObj.drawString("[" + ms + " ms]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); drawString("[" + ms + " ms]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
} }
} }

View File

@ -3,7 +3,6 @@ package dev.resent.module.impl.hud;
import dev.resent.module.Theme; 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 net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -11,11 +10,9 @@ public class PotCounter extends RenderModule {
public PotCounter() { public PotCounter() {
super("PotCounter", Category.HUD, 4, 74, true); super("PotCounter", Category.HUD, 4, 74, true);
addSetting(tshadow);
} }
public int potinv = 0; public int potinv = 0;
public BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", true);
public int getWidth() { public int getWidth() {
return mc.fontRendererObj.getStringWidth("[" + potinv + " Pots]") + 4; return mc.fontRendererObj.getStringWidth("[" + potinv + " Pots]") + 4;
@ -36,6 +33,6 @@ public class PotCounter extends RenderModule {
} }
} }
mc.fontRendererObj.drawString("[" + potinv + " Pots]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); drawString("[" + potinv + " Pots]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
} }
} }

View File

@ -60,9 +60,9 @@ public class PotionHUD extends RenderModule {
} else if (potioneffect.getAmplifier() == 3) { } else if (potioneffect.getAmplifier() == 3) {
s1 = String.valueOf(String.valueOf(s1)) + " " + I18n.format("enchantment.level.4", new Object[0]); s1 = String.valueOf(String.valueOf(s1)) + " " + I18n.format("enchantment.level.4", new Object[0]);
} }
mc.fontRendererObj.drawString(s1, (getX() + 21), (getY() + i2 - 14), 16777215, true); drawString(s1, (getX() + 21), (getY() + i2 - 14), 16777215, true);
String s2 = Potion.getDurationString(potioneffect); String s2 = Potion.getDurationString(potioneffect);
mc.fontRendererObj.drawString(s2, (getX() + 21), (getY() + i2 + 10 - 14), 8355711, true); drawString(s2, (getX() + 21), (getY() + i2 + 10 - 14), 8355711, true);
i2 += l; i2 += l;
} }
} }

View File

@ -27,7 +27,7 @@ public class ReachDisplay extends RenderModule {
@Override @Override
public void draw() { public void draw() {
mc.fontRendererObj.drawStringWithShadow("[" + df2.format(range) + " Blocks]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId())); drawString("[" + df2.format(range) + " Blocks]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
} }
public void onAttack(Entity e){ public void onAttack(Entity e){

View File

@ -3,17 +3,13 @@ package dev.resent.module.impl.hud;
import dev.resent.module.Theme; 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;
public class ServerInfo extends RenderModule { public class ServerInfo extends RenderModule {
public ServerInfo() { public ServerInfo() {
super("Server info", Category.HUD, 4, 44, true); super("Server info", Category.HUD, 4, 44, true);
addSetting(tshadow);
} }
public BooleanSetting tshadow = new BooleanSetting("Text shadow", "", true);
public int getWidth() { public int getWidth() {
return mc.fontRendererObj.getStringWidth(getText()) + 4; return mc.fontRendererObj.getStringWidth(getText()) + 4;
} }
@ -23,7 +19,7 @@ public class ServerInfo extends RenderModule {
} }
public void draw() { public void draw() {
mc.fontRendererObj.drawString(getText(), this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), tshadow.getValue()); drawString(getText(), this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
} }
public String getText() { public String getText() {

View File

@ -18,7 +18,6 @@ public class Watermark extends RenderModule {
@Override @Override
public void draw() { public void draw() {
fr = mc.fontRendererObj;
this.setHeight(fr.FONT_HEIGHT * 2 + 4); this.setHeight(fr.FONT_HEIGHT * 2 + 4);
this.setWidth(fr.getStringWidth(Resent.NAME + " client 3.2 ") * 2); this.setWidth(fr.getStringWidth(Resent.NAME + " client 3.2 ") * 2);
@ -26,9 +25,9 @@ public class Watermark extends RenderModule {
GlStateManager.translate(this.x + 1, this.y + 1, 0); GlStateManager.translate(this.x + 1, this.y + 1, 0);
GlStateManager.translate(-(this.x + 1), -(this.y + 1), 0); GlStateManager.translate(-(this.x + 1), -(this.y + 1), 0);
GlStateManager.scale(2f, 2f, 2f); GlStateManager.scale(2f, 2f, 2f);
int i = fr.drawString(Resent.NAME + " client", (this.x + 1) / 2, (this.y + 1) / 2, Color.RED.getRGB(), true); int i = drawString(Resent.NAME + " client", (this.x + 1) / 2, (this.y + 1) / 2, Color.RED.getRGB(), Theme.getTextShadow());
GlStateManager.scale(0.5f, 0.5f, 0.5f); GlStateManager.scale(0.5f, 0.5f, 0.5f);
fr.drawString(Resent.VERSION + "", (i * 2), this.y + (fr.FONT_HEIGHT * 2 - 7), Theme.getFontColor(Theme.getFontId()), true); drawString(Resent.VERSION + "", (i * 2), this.y + (fr.FONT_HEIGHT * 2 - 7), Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }
} }

View File

@ -8,11 +8,12 @@ import dev.resent.module.setting.ModeSetting;
public class HUD extends Mod{ public class HUD extends Mod{
public HUD(){ public HUD(){
super("Theme", Category.MISC, true); super("Theme", Category.MISC, true);
addSetting(fontTheme, animationTheme, round); addSetting(fontTheme, animationTheme, tshadow, round);
} }
public static final ModeSetting fontTheme = new ModeSetting("Font", "", "Classic", "Rainbow"); public static final ModeSetting fontTheme = new ModeSetting("Font", "", "Classic", "Rainbow", "Chroma");
public static final BooleanSetting round = new BooleanSetting("Rounded", "", true); public static final BooleanSetting round = new BooleanSetting("Rounded", "", true);
public static final BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", true);
public static final ModeSetting animationTheme = new ModeSetting("Animation", "", "Ease back in", "Ease in out quad", "Elastic", "Smooth step", "Decelerate"); 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); //public static final BooleanSetting animated = new BooleanSetting("Animated", "", true);

View File

@ -1,8 +1,5 @@
package dev.resent.util.render; package dev.resent.util.render;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_ONE_MINUS_SRC_ALPHA;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.GL_SRC_ALPHA;
import dev.resent.module.setting.ModeSetting; import dev.resent.module.setting.ModeSetting;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer; import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
@ -13,18 +10,19 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
public class RenderUtils { public class RenderUtils {
/*public static void drawChromaString(String string, int param1, int param2, boolean shadow) { public static void drawChromaString(final String string, final int x, final int y, final boolean shadow) {
Minecraft mc = Minecraft.getMinecraft(); final Minecraft mc = Minecraft.getMinecraft();
int xTmp = x;
int xTmp = param1; char[] charArray;
for (char textChar : string.toCharArray()) { for (int length = (charArray = string.toCharArray()).length, j = 0; j < length; ++j) {
long l = System.currentTimeMillis() - (xTmp * 10 - param2 * 10); final char textChar = charArray[j];
int i = Color.HSBtoRGB(l % (int) 2000.0F / 2000.0F, 0.8F, 0.8F); final long l = System.currentTimeMillis() - (xTmp * 10 - y * 10);
String tmp = String.valueOf(textChar); final int i = Color.HSBtoRGB(l % 2000L / 2000.0f, 0.8f, 0.8f);
mc.fontRendererObj.drawString(tmp, xTmp, param2, i, shadow); final String tmp = String.valueOf(textChar);
mc.fontRendererObj.drawString(tmp, (float)xTmp, (float)y, i, shadow);
xTmp += mc.fontRendererObj.getCharWidth(textChar); xTmp += mc.fontRendererObj.getCharWidth(textChar);
} }
}*/ }
public static void drawRoundedRect(final float paramInt1, final float paramInt2, final float paramInt3, final float paramInt4, final float radius, final int color) { public static void drawRoundedRect(final float paramInt1, final float paramInt2, final float paramInt3, final float paramInt4, final float radius, final int color) {
final float f1 = (color >> 24 & 0xFF) / 255.0f; final float f1 = (color >> 24 & 0xFF) / 255.0f;