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;
case "Rainbow":
return 50;
case "Chroma":
return 6942069;
}
return -1;
}
@ -73,4 +74,8 @@ public class Theme {
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) {
this.enabled = state;
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.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting;
import dev.resent.util.misc.FuncUtils;
public class CPS extends RenderModule {
public CPS() {
super("CPS", Category.HUD, 50, 4, true);
addSetting(tshadow);
}
private List<Long> clicks = new ArrayList<>();
private boolean wasPressed;
private long lastPressed;
public BooleanSetting tshadow = new BooleanSetting("Text shadow", "", true);
public int getWidth() { return mc.fontRendererObj.getStringWidth("[CPS: "+ clicks.size() + "]") + 4; }
public int getHeight() { return mc.fontRendererObj.FONT_HEIGHT+4; }
@ -40,7 +37,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.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.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.network.play.server.S19PacketEntityStatus;
@ -12,12 +11,10 @@ public class ComboCounter extends RenderModule {
public ComboCounter() {
super("ComboCounter", Category.HUD, 4, 24, true);
addSetting(tshadow);
}
public static boolean attacked = false;
public static int combo = 0;
public static BooleanSetting tshadow = new BooleanSetting("Text shadow", "", true);
public void onAttack(Entity e) {
if (this.isEnabled()) {
@ -44,6 +41,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.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.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting;
import net.minecraft.client.Minecraft;
public class FPS extends RenderModule {
@ -12,11 +11,8 @@ public class FPS extends RenderModule {
public FPS() {
super("FPS", Category.HUD, 4, 14, true);
addSetting(tshadow);
}
public BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", true);
public int getWidth() {
return mc.fontRendererObj.getStringWidth(getText()) + 4;
}
@ -32,7 +28,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.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.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting;
public class Health extends RenderModule {
public Health() {
super("Health Display", Category.HUD, 4, 64, true);
addSetting(tshadow);
}
public BooleanSetting tshadow = new BooleanSetting("Text shadow", "", true);
public int getHeight() {
return mc.fontRendererObj.FONT_HEIGHT + 4;
}
@ -24,6 +20,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.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;
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.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()));
drawString(" X: " + px, this.x + 5, this.y + 14, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
drawString(" Y: " + py, this.x + 5, this.y + 24, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
drawString(" Z: " + pz, this.x + 5, this.y + 34, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
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.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()));
// drawStringWithShadow(" Dir: " + Direction.directionsF[rot], this.x+5+mc.fontRendererObj.getStringWidth(" X: " + px), this.y + 14, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
drawString(" Biome: " + mc.theWorld.getBiomeGenForCoords(new BlockPos(px, py, pz)).biomeName, this.x + 5, this.y + 44, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
//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;
//}

View File

@ -3,27 +3,24 @@ package dev.resent.module.impl.hud;
import dev.resent.module.Theme;
import dev.resent.module.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting;
public class Ping extends RenderModule {
public Ping() {
super("Ping Display", Category.HUD, 4, 54, true);
addSetting(tshadow);
}
public BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", true);
@Override
public void draw() {
int ms = 0;
if (mc.isSingleplayer()) {
ms = Theme.getFontColor(Theme.getFontId());
ms = -1;
}
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.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.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@ -11,11 +10,9 @@ public class PotCounter extends RenderModule {
public PotCounter() {
super("PotCounter", Category.HUD, 4, 74, true);
addSetting(tshadow);
}
public int potinv = 0;
public BooleanSetting tshadow = new BooleanSetting("Text Shadow", "", true);
public int getWidth() {
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) {
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);
mc.fontRendererObj.drawString(s2, (getX() + 21), (getY() + i2 + 10 - 14), 8355711, true);
drawString(s2, (getX() + 21), (getY() + i2 + 10 - 14), 8355711, true);
i2 += l;
}
}

View File

@ -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.getFontId()));
drawString("[" + df2.format(range) + " Blocks]", this.x + 2, this.y + 2, Theme.getFontColor(Theme.getFontId()), Theme.getTextShadow());
}
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.base.Category;
import dev.resent.module.base.RenderModule;
import dev.resent.module.setting.BooleanSetting;
public class ServerInfo extends RenderModule {
public ServerInfo() {
super("Server info", Category.HUD, 4, 44, true);
addSetting(tshadow);
}
public BooleanSetting tshadow = new BooleanSetting("Text shadow", "", true);
public int getWidth() {
return mc.fontRendererObj.getStringWidth(getText()) + 4;
}
@ -23,7 +19,7 @@ public class ServerInfo extends RenderModule {
}
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() {

View File

@ -18,7 +18,6 @@ public class Watermark extends RenderModule {
@Override
public void draw() {
fr = mc.fontRendererObj;
this.setHeight(fr.FONT_HEIGHT * 2 + 4);
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.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);
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();
}
}

View File

@ -8,11 +8,12 @@ import dev.resent.module.setting.ModeSetting;
public class HUD extends Mod{
public HUD(){
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 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 BooleanSetting animated = new BooleanSetting("Animated", "", true);

View File

@ -1,8 +1,5 @@
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 net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
@ -13,18 +10,19 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
public class RenderUtils {
/*public static void drawChromaString(String string, int param1, int param2, boolean shadow) {
Minecraft mc = Minecraft.getMinecraft();
int xTmp = param1;
for (char textChar : string.toCharArray()) {
long l = System.currentTimeMillis() - (xTmp * 10 - param2 * 10);
int i = Color.HSBtoRGB(l % (int) 2000.0F / 2000.0F, 0.8F, 0.8F);
String tmp = String.valueOf(textChar);
mc.fontRendererObj.drawString(tmp, xTmp, param2, i, shadow);
public static void drawChromaString(final String string, final int x, final int y, final boolean shadow) {
final Minecraft mc = Minecraft.getMinecraft();
int xTmp = x;
char[] charArray;
for (int length = (charArray = string.toCharArray()).length, j = 0; j < length; ++j) {
final char textChar = charArray[j];
final long l = System.currentTimeMillis() - (xTmp * 10 - y * 10);
final int i = Color.HSBtoRGB(l % 2000L / 2000.0f, 0.8f, 0.8f);
final String tmp = String.valueOf(textChar);
mc.fontRendererObj.drawString(tmp, (float)xTmp, (float)y, i, shadow);
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) {
final float f1 = (color >> 24 & 0xFF) / 255.0f;