cape button selection indicator + fixed togglesprint old bg

This commit is contained in:
Rxn69 2023-06-29 11:48:21 +05:30
parent aed4d6c28c
commit b32ebdeb13
3 changed files with 3612 additions and 1085 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,11 @@
package rip.athena.client.gui.clickgui.components.capes;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import rip.athena.client.Athena;
import rip.athena.client.cosmetics.cape.Cape;
import rip.athena.client.font.FontManager;
@ -68,11 +72,19 @@ public class CapeButton extends MenuButton {
}
if(selected) {
text = cape.getName() + " selected";
text = cape.getName();
} else {
text = cape.getName();
}
RoundedUtils.drawRound(x + width - 20, y + 10, 10, 10, 4, Color.GRAY);
if(selected) {
Color color = Color.GREEN;
RoundedUtils.drawRound(x + width - 20, y + 10, 10, 10, 4, color);
}
drawText(text, x + (width / 2 - getStringWidth(text) / 2), y + height - 20, -1);
GlStateManager.color(1,1,1);

View File

@ -2,6 +2,7 @@ package rip.athena.client.modules.impl.mods;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.util.MovementInputFromOptions;
import org.lwjgl.opengl.GL11;
@ -93,7 +94,7 @@ public class ToggleSprint extends Module {
};
addHUD(hud);
}
public static void update(Minecraft mc, MovementInputFromOptions options, EntityPlayerSP thisPlayer) {
options.moveStrafe = 0.0F;
options.moveForward = 0.0F;
@ -175,14 +176,12 @@ public class ToggleSprint extends Module {
UpdateStatus(options, thisPlayer, settings);
}
public static void UpdateSprint(boolean newValue, boolean doubleTapped)
{
public static void UpdateSprint(boolean newValue, boolean doubleTapped) {
sprint = newValue;
sprintDoubleTapped = doubleTapped;
}
public static void UpdateStatus(MovementInputFromOptions options, EntityPlayerSP thisPlayer, GameSettings settings)
{
public static void UpdateStatus(MovementInputFromOptions options, EntityPlayerSP thisPlayer, GameSettings settings) {
String output = "";
@ -191,28 +190,27 @@ public class ToggleSprint extends Module {
boolean isHoldingSneak = settings.keyBindSneak.isKeyDown();
boolean isHoldingSprint = settings.keyBindSprint.isKeyDown();
if(isFlying)
{
if(isFlying) {
DecimalFormat numFormat = new DecimalFormat("#.00");
String speedVert = numFormat.format(flyboostspeedVertical);
String speedHori = numFormat.format(flyboostspeedHorizontal);
String label = speedVert + "x, " + speedHori + "x";
if(speedVert.equalsIgnoreCase(speedHori)) {
label = speedVert + "x";
label = speedVert + "x";
}
if (optionEnableFlyBoost && sprint) output += "[Flying (" + label + " boost)] ";
else output += "[Flying] ";
}
if(isRiding) output += "[Riding] ";
if(isRiding) output += "[Riding] ";
if (options.sneak) {
if(isFlying) output += "[Descending] ";
else if(isRiding) output += "[Dismounting] ";
else if(isHoldingSneak) output += "[Sneaking (Key Held)] ";
else output += "[Sneaking (Toggled)] ";
if(isFlying) output += "[Descending] ";
else if(isRiding) output += "[Dismounting] ";
else if(isHoldingSneak) output += "[Sneaking (Key Held)] ";
else output += "[Sneaking (Toggled)] ";
} else if (sprint) {
if(!isFlying && !isRiding) {
@ -237,11 +235,11 @@ public class ToggleSprint extends Module {
hud.setWidth(FontManager.getProductSansRegular(25).width(textForHUD));
hud.setHeight((int) (FontManager.getProductSansRegular(25).height() + 3));
}
if (mc.gameSettings.showDebugInfo) {
return;
}
GL11.glPushMatrix();
if (backGround) {
@ -256,7 +254,7 @@ public class ToggleSprint extends Module {
} else if (backgroundMode.equalsIgnoreCase("Fade")) {
RoundedUtils.drawRoundedRect(hud.getX(), hud.getY(), hud.getX() + width, hud.getY() + height, 8.0f, Athena.INSTANCE.getThemeManager().getTheme().getAccentColor().getRGB());
} else {
RoundedUtils.drawRoundedRect(hud.getX(), hud.getY(), hud.getX() + width, hud.getY() + height, 12, background.getRGB());
Gui.drawRect(hud.getX() - 5, hud.getY() - 5, hud.getX() + width + getExtraWidth() - 20, hud.getY() + height + 5, background.getRGB());
}
}
@ -274,10 +272,27 @@ public class ToggleSprint extends Module {
} else if(color.getBlue() == 6 && color.getRed() == 6 && color.getGreen() == 6) {
DrawUtils.drawCustomFontChromaString(FontManager.getProductSansRegular(25),textForHUD, hud.getX() + 1, hud.getY() + 3, false ,true);
} else {
FontManager.getProductSansRegular(25).drawString(textForHUD, hud.getX() + 1, hud.getY() + 3, color.getRGB());
FontManager.getProductSansRegular(25).drawString(textForHUD, hud.getX(), hud.getY(), color.getRGB());
}
}
GL11.glColor3f(1, 1, 1);
GL11.glPopMatrix();
}
public int getExtraWidth() {
if(!customFont) {
// if(textForHUD.toLowerCase().contains("l"))
// return mc.fontRendererObj.getStringWidth(textForHUD) - 2;
// else if (textForHUD.equals("[Flying] [Descending]") || textForHUD.equals("[Flying] [Inactive]") || textForHUD.startsWith("Riding") || textForHUD.startsWith("["))
// return mc.fontRendererObj.getStringWidth(textForHUD) + 5;
// else
// return mc.fontRendererObj.getStringWidth(textForHUD) + 2;
return mc.fontRendererObj.getStringWidth(textForHUD) + 2;
} else {
if(textForHUD.toLowerCase().contains("l"))
return FontManager.getProductSansRegular(25).width(textForHUD);
else
return FontManager.getProductSansRegular(25).width(textForHUD) + 2;
}
}
}