diff --git a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/TargetStrafe.kt b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/TargetStrafe.kt index 55d522e962..b9cef23425 100644 --- a/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/TargetStrafe.kt +++ b/src/main/java/net/ccbluex/liquidbounce/features/module/modules/movement/TargetStrafe.kt @@ -34,25 +34,28 @@ import kotlin.math.sin object TargetStrafe : Module() { private val thirdPersonViewValue = BoolValue("ThirdPersonView", false) - private val renderModeValue = ListValue("RenderMode", arrayOf("Circle", "Polygon", "Zavz", "None"), "Zavz") - private val zavzRender = ListValue("Zavz-Render", arrayOf("Circle", "Points"), "Points") - - private var redValue = IntegerValue("Zavz-Red", 0, 0, 255) { renderModeValue.get().equals("Zavz", true) } - private var greenValue = IntegerValue("Zavz-Green", 0, 0, 255) { renderModeValue.get().equals("Zavz", true) } - private var blueValue = IntegerValue("Zavz-Blue", 0, 0, 255) { renderModeValue.get().equals("Zavz", true) } - private var alphaValue = IntegerValue("Zavz-Alpha", 255, 0, 255) { renderModeValue.get().equals("Zavz", true) } - private var rainbowValue = BoolValue("Zavz-RainBow", false).displayable { renderModeValue.get().equals("Zavz", true) } - - private val pointsProperty = IntegerValue("Points", 12, 1, 18) - private val adaptiveSpeedProperty = BoolValue("Adapt Speed", true) - private val lineWidthValue = FloatValue("LineWidth", 1f, 1f, 10f).displayable {!renderModeValue.equals("None")} - private val radiusModeValue = ListValue("RadiusMode", arrayOf("Normal", "Strict"/*, "Dynamic"*/), "Normal") private val radiusValue = FloatValue("Radius", 0.5f, 0.1f, 5.0f) + private val radiusModeValue = ListValue("RadiusMode", arrayOf("Normal", "Strict"/*, "Dynamic"*/), "Normal") + private val ongroundValue = BoolValue("OnlyOnGround",false) private val holdSpaceValue = BoolValue("HoldSpace", false) private val onlySpeedValue = BoolValue("OnlySpeed", true) - private val trips = FloatValue("Radius", 2.0f, 0.1f, 4.0f) + + private val pointsProperty = IntegerValue("Points", 12, 1, 18) + private val adaptiveSpeedProperty = BoolValue("Adapt Speed", true) + private val lineWidthValue = FloatValue("LineWidth", 1f, 1f, 10f).displayable {!renderModeValue.equals("None")} + private val trips = FloatValue("Trips", 2.0f, 0.1f, 4.0f) + + private val renderModeValue = ListValue("RenderMode", arrayOf("Circle", "Polygon", "Zavz", "None"), "Zavz") + private val zavzRender = ListValue("Zavz-Render", arrayOf("Circle", "Points"), "Points").displayable { renderModeValue.equals("Zavz") } + + private var redValue = IntegerValue("Zavz-Red", 0, 0, 255).displayable { renderModeValue.get().equals("Zavz", true) } + private var greenValue = IntegerValue("Zavz-Green", 0, 0, 255).displayable { renderModeValue.get().equals("Zavz", true) } + private var blueValue = IntegerValue("Zavz-Blue", 0, 0, 255).displayable { renderModeValue.get().equals("Zavz", true) } + private var alphaValue = IntegerValue("Zavz-Alpha", 255, 0, 255).displayable { renderModeValue.get().equals("Zavz", true) } + private var rainbowValue = BoolValue("Zavz-RainBow", false).displayable { renderModeValue.get().equals("Zavz", true) } + private var direction = -1.0 private var directionA = 1 diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/resources/MixinDefaultResourcePack.java b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/resources/MixinDefaultResourcePack.java deleted file mode 100644 index 0a98464b1b..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/resources/MixinDefaultResourcePack.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.injection.forge.mixins.resources; - -import com.google.common.collect.ImmutableSet; -import net.minecraft.client.resources.DefaultResourcePack; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import java.util.Set; - -/** - * The type Mixin default resource pack. - */ -@Mixin(DefaultResourcePack.class) -public class MixinDefaultResourcePack { - - /** - * The constant defaultResourceDomains. - */ - @Final - @Shadow - public static final Set defaultResourceDomains = ImmutableSet - .of("minecraft", "realms"); - -} diff --git a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/resources/MixinSkinManager.java b/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/resources/MixinSkinManager.java deleted file mode 100644 index 8d67e5f5aa..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/injection/forge/mixins/resources/MixinSkinManager.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.injection.forge.mixins.resources; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import net.minecraft.client.resources.SkinManager; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.util.Map; - -/** - * The type Mixin skin manager. - */ -@Mixin(SkinManager.class) -public class MixinSkinManager { - - @Inject(method = "loadSkinFromCache", at = @At("HEAD")) - private void injectSkinProtect(GameProfile gameProfile, CallbackInfoReturnable> cir) { - } -} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontFamily.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontFamily.java deleted file mode 100644 index 7ce07cbbd8..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontFamily.java +++ /dev/null @@ -1,13 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.api; - -public interface FontFamily { - - FontRenderer ofSize(int size); - - FontType font(); -} diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontManager.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontManager.java deleted file mode 100644 index 739d862f41..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontManager.java +++ /dev/null @@ -1,10 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.api; -@FunctionalInterface -public interface FontManager { - FontFamily fontFamily(FontType fontType); -} diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontRenderer.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontRenderer.java deleted file mode 100644 index c247cb14ab..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontRenderer.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.api; - -public interface FontRenderer { - float drawString(CharSequence text, float x, float y, int color, boolean dropShadow); - - String trimStringToWidth(CharSequence text, int width, boolean reverse); - int stringWidth(CharSequence text); - - int getHeight(); - - //region default methods - default float drawString(CharSequence text, float x, float y, int color) { - return drawString(text, x, y, color, false); - } - default void drawString(CharSequence text, int x, int y, int color) { - drawString(text, x, y, color, false); - } - default String trimStringToWidth(CharSequence text, int width) { - return trimStringToWidth(text, width, false); - } - - default float drawCenteredString(CharSequence text, float x, float y, int color, boolean dropShadow) { - return drawString(text, x - stringWidth(text) / 2.0F, y, color, dropShadow); - } - default float getMiddleOfBox(float boxHeight) { - return boxHeight / 2f - getHeight() / 2f; - } - - default void drawCenteredString(CharSequence text, float x, float y, int color) { - drawCenteredString(text, x, y, color, false); - } -} diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontType.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontType.java deleted file mode 100644 index 9c37ff6c23..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/api/FontType.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.api; -@SuppressWarnings("SpellCheckingInspection") -public enum FontType { - ICONFONT("stylesicons.ttf"), - - Check("check.ttf"), - SF("SF.ttf"), - MAINMENU("mainmenu.ttf"); - - private final String fileName; - - FontType(String fileName) { - this.fileName = fileName; - } - - public String fileName() { return fileName; } -} diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/Fonts.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/Fonts.java deleted file mode 100644 index ee6ca4f927..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/Fonts.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.impl; - -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontFamily; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontManager; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontRenderer; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontType; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.logo.info; -@SuppressWarnings("SpellCheckingInspection") -public interface Fonts { - - FontManager FONT_MANAGER = info.getFontManager(); - - interface ICONFONT { - - FontFamily ICONFONT = FONT_MANAGER.fontFamily(FontType.ICONFONT); - - final class ICONFONT_24 { - public static final FontRenderer ICONFONT_24 = ICONFONT.ofSize(24); - - private ICONFONT_24() { - } - } - - } - - interface MAINMENU { - FontFamily MAINMENU = FONT_MANAGER.fontFamily(FontType.MAINMENU); - final class MAINMENU30 { - public static final FontRenderer MAINMENU30 = MAINMENU.ofSize(30); - - private MAINMENU30() { - } - } - - } - - interface CheckFont { - FontFamily CheckFont = FONT_MANAGER.fontFamily(FontType.Check); - - final class CheckFont_24 { - public static final FontRenderer CheckFont_24 = CheckFont.ofSize(24); - - private CheckFont_24() { - } - } - } - - interface SF { - - FontFamily SF = FONT_MANAGER.fontFamily(FontType.SF); - - final class SF_16 { - public static final FontRenderer SF_16 = SF.ofSize(16); - - private SF_16() { - } - } - - final class SF_17 { - public static final FontRenderer SF_17 = SF.ofSize(17); - - private SF_17() { - } - } - - final class SF_18 { - public static final FontRenderer SF_18 = SF.ofSize(18); - - private SF_18() { - } - } - - final class SF_20 { - public static final FontRenderer SF_20 = SF.ofSize(20); - - private SF_20() { - } - } - } -} diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/SimpleFontFamily.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/SimpleFontFamily.java deleted file mode 100644 index 2ebe66e857..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/SimpleFontFamily.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.impl; - -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontFamily; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontRenderer; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontType; -final class SimpleFontFamily implements FontFamily { - - private final FontType fontType; - private final java.awt.Font awtFont; - - private SimpleFontFamily(FontType fontType, java.awt.Font awtFont) { - this.fontType = fontType; - this.awtFont = awtFont; - } - - static FontFamily create(FontType fontType, java.awt.Font awtFont) { - return new SimpleFontFamily(fontType, awtFont); - } - - @Override - public FontRenderer ofSize(int size) { - return SimpleFontRenderer.create(awtFont.deriveFont(java.awt.Font.PLAIN, size)); - } - - @Override - public FontType font() { return fontType; } -} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/SimpleFontManager.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/SimpleFontManager.java deleted file mode 100644 index 650346c8eb..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/SimpleFontManager.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.impl; - -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontFamily; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontManager; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontType; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.util.SneakyThrowing; -import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IResource; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.util.ResourceLocation; - -import java.awt.*; -import java.io.IOException; -import java.io.InputStream; -import java.util.EnumMap; - -public final class SimpleFontManager implements FontManager { - - private SimpleFontManager() {} - - public static FontManager create() { - return new SimpleFontManager(); - } - - private static final String FONT_DIRECTORY = "fdpclient/font/"; - private final FontRegistry fonts = new FontRegistry(); - - @Override - public FontFamily fontFamily(FontType fontType) { - return fonts.fontFamily(fontType); - } - - private static final class FontRegistry extends EnumMap { - - private FontRegistry() { super(FontType.class); } - - private FontFamily fontFamily(FontType fontType) { - return computeIfAbsent(fontType, ignored -> { - try { - return SimpleFontFamily.create(fontType, readFontFromResources(fontType)); - } catch(IOException e) { - throw SneakyThrowing.sneakyThrow(e); - } - }); - } - - private static Font readFontFromResources(FontType fontType) throws IOException { - IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager(); - ResourceLocation location = new ResourceLocation(FONT_DIRECTORY + fontType.fileName()); - IResource resource; - - try { - resource = resourceManager.getResource(location); - } catch(IOException e) { - throw new IOException("Couldn't find resource: " + location, e); - } - - try(InputStream resourceInputStream = resource.getInputStream()) { - return readFont(resourceInputStream); - } - } - - private static Font readFont(InputStream resource) { - Font font; - - try { - font = Font.createFont(Font.TRUETYPE_FONT, resource); - } catch(FontFormatException e) { - throw new RuntimeException("Resource does not contain the required font tables for the specified format", e); - } catch(IOException e) { - throw new RuntimeException("Couldn't completely read font resource", e); - } - - return font; - } - } -} diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/SimpleFontRenderer.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/SimpleFontRenderer.java deleted file mode 100644 index 774ccdfa4a..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/impl/SimpleFontRenderer.java +++ /dev/null @@ -1,449 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.impl; - -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.texture.DynamicTexture; -import org.lwjgl.opengl.GL11; - -import java.awt.*; -import java.awt.geom.Rectangle2D; -import java.awt.image.BufferedImage; - -import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D; - -/** - * @author Zywl - */ -@SuppressWarnings("MagicNumber") -final class SimpleFontRenderer implements FontRenderer { - - private static final int[] COLOR_CODES = setupMinecraftColorCodes(); - private static final String COLORS = "0123456789abcdefklmnor"; - private static final char COLOR_PREFIX = '\u00a7'; - - private static final short CHARS = 256; - private static final float IMG_SIZE = 512; - private static final float CHAR_OFFSET = 0f; - - private final CharData[] charData = new CharData[CHARS]; - private final CharData[] boldChars = new CharData[CHARS]; - private final CharData[] italicChars = new CharData[CHARS]; - private final CharData[] boldItalicChars = new CharData[CHARS]; - - private final Font awtFont; - private final boolean antiAlias; - private final boolean fractionalMetrics; - - private DynamicTexture texturePlain; - private DynamicTexture textureBold; - private DynamicTexture textureItalic; - private DynamicTexture textureItalicBold; - private int fontHeight = -1; - - //region instantiating - private SimpleFontRenderer(Font awtFont, boolean antiAlias, boolean fractionalMetrics) { - this.awtFont = awtFont; - this.antiAlias = antiAlias; - this.fractionalMetrics = fractionalMetrics; - setupBoldItalicFonts(); - } - - static FontRenderer create(Font font, boolean antiAlias) { - return new SimpleFontRenderer(font, antiAlias, true); - } - - public static FontRenderer create(Font font) { - return create(font, true); - } - - private DynamicTexture setupTexture(Font font, boolean antiAlias, boolean fractionalMetrics, CharData[] chars) { - return new DynamicTexture(generateFontImage(font, antiAlias, fractionalMetrics, chars)); - } - - private BufferedImage generateFontImage(Font font, boolean antiAlias, boolean fractionalMetrics, CharData[] chars) { - final int imgSize = (int) IMG_SIZE; - BufferedImage bufferedImage = new BufferedImage(imgSize, imgSize, BufferedImage.TYPE_INT_ARGB); - Graphics2D graphics = (Graphics2D) bufferedImage.getGraphics(); - - graphics.setFont(font); - graphics.setColor(new Color(255, 255, 255, 0)); - graphics.fillRect(0, 0, imgSize, imgSize); - graphics.setColor(Color.WHITE); - - graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); - graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - graphics.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); - - if (this.fractionalMetrics) { - graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON); - } else { - graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF); - } - - FontMetrics fontMetrics = graphics.getFontMetrics(); - int charHeight = 0, positionX = 0, positionY = 1; - - for (int i = 0; i < chars.length; i++) { - char ch = (char) i; - CharData charData = new CharData(); - Rectangle2D dimensions = fontMetrics.getStringBounds(String.valueOf(ch), graphics); - - charData.width = dimensions.getBounds().width + 8; - charData.height = dimensions.getBounds().height; - - if (positionX + charData.width >= imgSize) { - positionX = 0; - positionY += charHeight; - charHeight = 0; - } - - if (charData.height > charHeight) { - charHeight = charData.height; - } - - charData.storedX = positionX; - charData.storedY = positionY; - - if (charData.height > fontHeight) { - this.fontHeight = charData.height; - } - - chars[i] = charData; - - graphics.drawString(String.valueOf(ch), positionX + 2, positionY + fontMetrics.getAscent()); - positionX += charData.width; - } - - return bufferedImage; - } - - private void setupBoldItalicFonts() { - this.texturePlain = setupTexture(awtFont, antiAlias, fractionalMetrics, charData); - this.textureBold = setupTexture(awtFont.deriveFont(Font.BOLD), antiAlias, fractionalMetrics, boldChars); - this.textureItalic = setupTexture(awtFont.deriveFont(Font.ITALIC), antiAlias, fractionalMetrics, italicChars); - this.textureItalicBold = setupTexture(awtFont.deriveFont(Font.BOLD | Font.ITALIC), antiAlias, fractionalMetrics, boldItalicChars); - } - //endregion - - @Override - public float drawString(CharSequence text, float x, float y, int color, boolean dropShadow) { - if (dropShadow) { - float shadowWidth = drawStringInternal(text, x + 0.5, y + 0.5, color, true); - return Math.max(shadowWidth, drawStringInternal(text, x, y, color, false)); - } else { - return drawStringInternal(text, x, y, color, false); - } - } - @SuppressWarnings("OverlyComplexMethod") - private float drawStringInternal(CharSequence text, double x, double y, int color, boolean shadow) { - x -= 1; - - if (text == null) return 0.0F; - if (color == 0x20FFFFFF) color = 0xFFFFFF; - if ((color & 0xFC000000) == 0) color |= 0xFF000000; - //endregion - - if (shadow) { - color = (color & 0xFCFCFC) >> 2 | color & 0xFF000000; - } - - CharData[] charData = this.charData; - float alpha = (color >> 24 & 0xFF) / 255.0F; - final boolean randomCase = false; - - x *= 2.0D; - y = (y - 3.0D) * 2.0D; - - //region rendering - GL11.glPushMatrix(); - GlStateManager.scale(0.5D, 0.5D, 0.5D); - GlStateManager.enableBlend(); - GlStateManager.blendFunc(770, 771); - GL11.glColor4f((color >> 16 & 0xFF) / 255.0F, (color >> 8 & 0xFF) / 255.0F, (color & 0xFF) / 255.0F, alpha); - GlStateManager.color((color >> 16 & 0xFF) / 255.0F, (color >> 8 & 0xFF) / 255.0F, (color & 0xFF) / 255.0F, alpha); - GlStateManager.enableTexture2D(); - GlStateManager.bindTexture(texturePlain.getGlTextureId()); - - GL11.glBindTexture(GL_TEXTURE_2D, texturePlain.getGlTextureId()); - GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); - - boolean underline = false; - boolean strikethrough = false; - boolean italic = false; - boolean bold = false; - - for (int i = 0, size = text.length(); i < size; i++) { - char character = text.charAt(i); - - if (character == COLOR_PREFIX && i + 1 < size) { - // TODO: Проверить, будет ли рисовать § без отдельного символа - int colorIndex = COLORS.indexOf(text.charAt(i + 1)); - - if (colorIndex < 16) { - bold = false; - italic = false; - underline = false; - strikethrough = false; - GlStateManager.bindTexture(texturePlain.getGlTextureId()); - charData = this.charData; - - if (colorIndex < 0) colorIndex = 15; - if (shadow) colorIndex += 16; - - int colorCode = COLOR_CODES[colorIndex]; - GlStateManager.color( - (colorCode >> 16 & 0xFF) / 255.0F, - (colorCode >> 8 & 0xFF) / 255.0F, - (colorCode & 0xFF) / 255.0F, - 255); - } else if (colorIndex == 17) { - bold = true; - - if (italic) { - GlStateManager.bindTexture(textureItalicBold.getGlTextureId()); - charData = boldItalicChars; - } else { - GlStateManager.bindTexture(textureBold.getGlTextureId()); - charData = boldChars; - } - } else if (colorIndex == 18) { - strikethrough = true; - } else if (colorIndex == 19) { - underline = true; - } else if (colorIndex == 20) { - italic = true; - - if (bold) { - GlStateManager.bindTexture(textureItalicBold.getGlTextureId()); - charData = boldItalicChars; - } else { - GlStateManager.bindTexture(textureItalic.getGlTextureId()); - charData = italicChars; - } - } else if (colorIndex == 21) { - bold = false; - italic = false; - underline = false; - strikethrough = false; - - GlStateManager.color( - (color >> 16 & 0xFF) / 255.0F, - (color >> 8 & 0xFF) / 255.0F, - (color & 0xFF) / 255.0F, - 255); - GlStateManager.bindTexture(texturePlain.getGlTextureId()); - - charData = this.charData; - } - - //noinspection AssignmentToForLoopParameter - i++; - } else if (character < charData.length) { - GL11.glBegin(GL11.GL_TRIANGLES); - drawChar(charData, character, (float) x, (float) y); - GL11.glEnd(); - - if (strikethrough) { - drawLine(x, - y + charData[character].height / 2.0F, - x + charData[character].width - 8.0D, - y + charData[character].height / 2.0F - ); - } - - if (underline) { - drawLine(x, - y + charData[character].height - 2.0D, - x + charData[character].width - 8.0D, - y + charData[character].height - 2.0D - ); - } - - x += charData[character].width - (character == ' ' ? 8 : 9); - } - } - - GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); - GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_DONT_CARE); - GL11.glPopMatrix(); - //endregion - - return (float) x / 2.0F; - } - - - - @Override - public String trimStringToWidth(CharSequence text, int width, boolean reverse) { - StringBuilder builder = new StringBuilder(); - - float f = 0.0F; - int i = reverse ? text.length() - 1 : 0; - int j = reverse ? -1 : 1; - boolean flag = false; - boolean flag1 = false; - - for (int k = i; k >= 0 && k < text.length() && f < width; k += j) { - char c0 = text.charAt(k); - float f1 = stringWidth(String.valueOf(c0)); - - if (flag) { - flag = false; - - if (c0 != 'l' && c0 != 'L') { - if (c0 == 'r' || c0 == 'R') { - flag1 = false; - } - } else { - flag1 = true; - } - } else if (f1 < 0.0F) { - flag = true; - } else { - f += f1; - if (flag1) ++f; - } - - if (f > width) break; - - if (reverse) { - builder.insert(0, c0); - } else { - builder.append(c0); - } - } - - return builder.toString(); - } - - @Override - public int stringWidth(CharSequence text) { - if (text == null) return 0; - int width = 0; - CharData[] currentData = charData; - boolean bold = false; - boolean italic = false; - - for (int i = 0, size = text.length(); i < size; i++) { - char character = text.charAt(i); - - if (character == COLOR_PREFIX && i + 1 < size) { - int colorIndex = COLORS.indexOf(text.charAt(i + 1)); - - if (colorIndex < 16) { // color - bold = false; - italic = false; - } else if (colorIndex == 17) { // bold - bold = true; - if (italic) currentData = boldItalicChars; - else currentData = boldChars; - } else if (colorIndex == 20) { // italic - italic = true; - if (bold) currentData = boldItalicChars; - else currentData = italicChars; - } else if (colorIndex == 21) { // reset - bold = false; - italic = false; - currentData = charData; - } - - //noinspection AssignmentToForLoopParameter - i++; - } else if (character < currentData.length) { - width += currentData[character].width - (character == ' ' ? 8 : 9); - } - } - - return width / 2; - } - - public CharData[] getCharData() { - return charData; - } - - //region shit - private static int[] setupMinecraftColorCodes() { - int[] colorCodes = new int[32]; - - for (int i = 0; i < 32; i++) { - int noClue = (i >> 3 & 0x1) * 85; - int red = (i >> 2 & 0x1) * 170 + noClue; - int green = (i >> 1 & 0x1) * 170 + noClue; - int blue = (i & 0x1) * 170 + noClue; - - if (i == 6) { - red += 85; - } - - if (i >= 16) { - red >>= 2; // divide by 4 - green >>= 2; - blue >>= 2; - } - - colorCodes[i] = (red & 0xFF) << 16 | (green & 0xFF) << 8 | blue & 0xFF; - } - - return colorCodes; - } - - private static class CharData { - - private int width; - private int height; - private int storedX; - private int storedY; - - private CharData() { - } - } - - //endregion - //region rendering - private static void drawChar(CharData[] chars, char c, float x, float y) { - drawQuad(x, y, chars[c].width, chars[c].height, chars[c].storedX, chars[c].storedY, chars[c].width, chars[c].height); - } - - private static void drawQuad(float x, float y, float width, float height, float srcX, float srcY, float srcWidth, float srcHeight) { - float renderSRCX = srcX / IMG_SIZE; - float renderSRCY = srcY / IMG_SIZE; - float renderSRCWidth = srcWidth / IMG_SIZE; - float renderSRCHeight = srcHeight / IMG_SIZE; - - - GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY); - GL11.glVertex2d(x + width, y); - GL11.glTexCoord2f(renderSRCX, renderSRCY); - GL11.glVertex2d(x, y); - GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight); - GL11.glVertex2d(x, y + height); - GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight); - GL11.glVertex2d(x, y + height); - GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY + renderSRCHeight); - GL11.glVertex2d(x + width, y + height); - GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY); - GL11.glVertex2d(x + width, y); - } - - private static void drawLine(double x, double y, double x1, double y1) { - GL11.glDisable(GL_TEXTURE_2D); - GL11.glLineWidth((float) 1.0); - GL11.glBegin(1); - GL11.glVertex2d(x, y); - GL11.glVertex2d(x1, y1); - GL11.glEnd(); - GL11.glEnable(GL_TEXTURE_2D); - } - - @Override - public int getHeight() { - return (fontHeight - 8) / 2; - } - - //endregion -} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/logo/OutlineUtils.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/logo/OutlineUtils.java deleted file mode 100644 index 7b488b75b9..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/logo/OutlineUtils.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.logo; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.shader.Framebuffer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.opengl.EXTPackedDepthStencil; - -import java.awt.*; - -import static org.lwjgl.opengl.EXTFramebufferObject.*; -import static org.lwjgl.opengl.GL11.*; - -@SideOnly(Side.CLIENT) -public class OutlineUtils { - - public static void renderOne(final float lineWidth) { - checkSetupFBO(); - glPushAttrib(GL_ALL_ATTRIB_BITS); - glDisable(GL_ALPHA_TEST); - glDisable(GL_TEXTURE_2D); - glDisable(GL_LIGHTING); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glLineWidth(lineWidth); - glEnable(GL_LINE_SMOOTH); - glEnable(GL_STENCIL_TEST); - glClear(GL_STENCIL_BUFFER_BIT); - glClearStencil(0xF); - glStencilFunc(GL_NEVER, 1, 0xF); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - } - - public static void renderTwo() { - glStencilFunc(GL_NEVER, 0, 0xF); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - } - - public static void renderThree() { - glStencilFunc(GL_EQUAL, 1, 0xF); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - } - - public static void renderFour(final Color color) { - setColor(color); - glDepthMask(false); - glDisable(GL_DEPTH_TEST); - glEnable(GL_POLYGON_OFFSET_LINE); - glPolygonOffset(1F, -2000000F); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F); - } - - public static void renderFive() { - glPolygonOffset(1F, 2000000F); - glDisable(GL_POLYGON_OFFSET_LINE); - glEnable(GL_DEPTH_TEST); - glDepthMask(true); - glDisable(GL_STENCIL_TEST); - glDisable(GL_LINE_SMOOTH); - glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE); - glEnable(GL_BLEND); - glEnable(GL_LIGHTING); - glEnable(GL_TEXTURE_2D); - glEnable(GL_ALPHA_TEST); - glPopAttrib(); - } - - public static void setColor(final Color color) { - glColor4d(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, color.getAlpha() / 255F); - } - - public static void checkSetupFBO() { - // Gets the FBO of Minecraft - final Framebuffer fbo = Minecraft.getMinecraft().getFramebuffer(); - - // Check if FBO isn't null - if(fbo != null) { - // Checks if screen has been resized or new FBO has been created - if(fbo.depthBuffer > -1) { - // Sets up the FBO with depth and stencil extensions (24/8 bit) - setupFBO(fbo); - // Reset the ID to prevent multiple FBO's - fbo.depthBuffer = -1; - } - } - } - - /** - * Sets up the FBO with depth and stencil - * - * @param fbo Framebuffer - */ - private static void setupFBO(final Framebuffer fbo) { - // Deletes old render buffer extensions such as depth - // Args: Render Buffer ID - glDeleteRenderbuffersEXT(fbo.depthBuffer); - // Generates a new render buffer ID for the depth and stencil extension - final int stencil_depth_buffer_ID = glGenRenderbuffersEXT(); - // Binds new render buffer by ID - // Args: Target (GL_RENDERBUFFER_EXT), ID - glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, stencil_depth_buffer_ID); - // Adds the depth and stencil extension - // Args: Target (GL_RENDERBUFFER_EXT), Extension (GL_DEPTH_STENCIL_EXT), - // Width, Height - glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, EXTPackedDepthStencil.GL_DEPTH_STENCIL_EXT, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); - // Adds the stencil attachment - // Args: Target (GL_FRAMEBUFFER_EXT), Attachment - // (GL_STENCIL_ATTACHMENT_EXT), Target (GL_RENDERBUFFER_EXT), ID - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, stencil_depth_buffer_ID); - // Adds the depth attachment - // Args: Target (GL_FRAMEBUFFER_EXT), Attachment - // (GL_DEPTH_ATTACHMENT_EXT), Target (GL_RENDERBUFFER_EXT), ID - glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, stencil_depth_buffer_ID); - } -} diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/logo/info.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/logo/info.java deleted file mode 100644 index 01045b7df0..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/logo/info.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.logo; - -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontManager; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.impl.SimpleFontManager; - -public class info { - public static String Name = "FDPCLIENT"; - - public static String version = ""; - public static String username; - private static info INSTANCE; - public static info getInstance() { - if (INSTANCE == null) INSTANCE = new info(); - return INSTANCE; - } - public static final FontManager fontManager = SimpleFontManager.create(); - public static FontManager getFontManager() { - return fontManager; - } -} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/util/SneakyThrowing.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/util/SneakyThrowing.java deleted file mode 100644 index bdcefd2c56..0000000000 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/fonts/util/SneakyThrowing.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ -package net.ccbluex.liquidbounce.ui.clickgui.fonts.util; - -public final class SneakyThrowing { - - public static RuntimeException sneakyThrow(Throwable throwable) { - return sneakyThrow0(throwable); - } - - @SuppressWarnings("unchecked") - private static T sneakyThrow0(Throwable throwable) throws T { - throw (T) throwable; - } - - private SneakyThrowing() { - throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); - } -} diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Module.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Module.java index c973ff0333..dfcd6b3fbb 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Module.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Module.java @@ -10,7 +10,7 @@ import net.ccbluex.liquidbounce.features.module.modules.client.HUD; import net.ccbluex.liquidbounce.ui.clickgui.ClickGUIModule; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.impl.Fonts; +import net.ccbluex.liquidbounce.ui.font.Fonts; import net.ccbluex.liquidbounce.utils.render.RenderUtils; import net.ccbluex.liquidbounce.utils.timer.TickTimer; import net.ccbluex.liquidbounce.value.TextValue; @@ -97,7 +97,7 @@ public void drawScreen(int mouseX, int mouseY) { } else { RenderUtils.drawRect(tab.getPosX(), y, tab.getPosX() + 100, y + 14, interpolateColor(new Color(40, 40, 40, 255), colorHUD, MathHelper.clamp_float(fraction, 0, 1))); } - Fonts.SF.SF_18.SF_18.drawString(module.getName(), tab.getPosX() + 2, (float) (y + 4), 0xffffffff, true); + Fonts.fontSFUI35.drawString(module.getName(), tab.getPosX() + 2, (float) (y + 4), 0xffffffff, true); if (!settings.isEmpty()) { double val = debugFPS / 8.3; diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Setting.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Setting.java index 33b37ecc4c..06bb429347 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Setting.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Setting.java @@ -9,7 +9,7 @@ import net.ccbluex.liquidbounce.FDPClient; import net.ccbluex.liquidbounce.features.module.modules.client.HUD; import net.ccbluex.liquidbounce.ui.clickgui.ClickGUIModule; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.impl.Fonts; +import net.ccbluex.liquidbounce.ui.font.Fonts; import net.ccbluex.liquidbounce.utils.MathUtils; import net.ccbluex.liquidbounce.utils.render.RenderUtils; import net.ccbluex.liquidbounce.utils.timer.TickTimer; @@ -62,7 +62,7 @@ public void drawScreen(int mouseX, int mouseY) { percent = Math.max(0, Math.min(1, (float) (percent + (Math.max(0, Math.min(percentBar, 1)) - percent) * (0.2 / clamp)))); RenderUtils.drawRect(module.tab.getPosX() + 1, y + 3, module.tab.getPosX() + 99, y + 14, new Color(0, 0, 0, 50).getRGB()); RenderUtils.drawRect(module.tab.getPosX() + 1, y + 3, module.tab.getPosX() + 1 + 98 * percent, y + 14, ClickGUIModule.generateColor()); - Fonts.SF.SF_18.SF_18.drawString(numberValue.getName() + " " + rounded, module.tab.getPosX() + 4, y + 5.5f, 0xffffffff, true); + Fonts.fontSFUI35.drawString(numberValue.getName() + " " + rounded, module.tab.getPosX() + 4, y + 5.5f, 0xffffffff, true); if (this.dragging) { double difference = numberValue.getMaximum() - numberValue.getMinimum(); @@ -95,7 +95,7 @@ public void drawScreen(int mouseX, int mouseY) { percent = Math.max(0, Math.min(1, (float) (percent + (Math.max(0, Math.min(percentBar, 1)) - percent) * (0.2 / clamp)))); RenderUtils.drawRect(module.tab.getPosX() + 1, y + 3, module.tab.getPosX() + 99, y + 14, new Color(0, 0, 0, 50).getRGB()); RenderUtils.drawRect(module.tab.getPosX() + 1, y + 3, module.tab.getPosX() + 1 + 98 * percent, y + 14, ClickGUIModule.generateColor()); - Fonts.SF.SF_18.SF_18.drawString(integerValue.getName() + " " + rounded, module.tab.getPosX() + 4, y + 5.5f, 0xffffffff, true); + Fonts.fontSFUI35.drawString(integerValue.getName() + " " + rounded, module.tab.getPosX() + 4, y + 5.5f, 0xffffffff, true); if (this.dragging2) { double difference = integerValue.getMaximum() - integerValue.getMinimum(); @@ -120,16 +120,16 @@ public void drawScreen(int mouseX, int mouseY) { RenderUtils.drawCheck(module.tab.getPosX() + 91, y + 8.5f, 2, ClickGUIModule.generateColor().brighter().getRGB()); } - Fonts.SF.SF_18.SF_18.drawString(boolValue.getName(), module.tab.getPosX() + 4, y + 5.5f, + Fonts.fontSFUI35.drawString(boolValue.getName(), module.tab.getPosX() + 4, y + 5.5f, new Color(227, 227, 227, 255).getRGB(), true); } if (setting instanceof ListValue) { final ListValue listValue = (ListValue) setting; - Fonts.SF.SF_17.SF_17.drawString(listValue.getName(), module.tab.getPosX() + 3, (float) (y + 6), + Fonts.fontSFUI35.drawString(listValue.getName(), module.tab.getPosX() + 3, (float) (y + 6), 0xffffffff, true); - Fonts.SF.SF_17.SF_17.drawString(listValue.get().toUpperCase(), - module.tab.getPosX() + 97 - Fonts.SF.SF_17.SF_17.stringWidth(listValue.get().toUpperCase()), y + 7f, + Fonts.fontSFUI35.drawString(listValue.get().toUpperCase(), + module.tab.getPosX() + 97 - Fonts.fontSFUI35.getStringWidth(listValue.get().toUpperCase()), y + 7f, new Color(255, 255, 255, 255).getRGB(), true); } @@ -143,12 +143,12 @@ public void drawScreen(int mouseX, int mouseY) { } RenderUtils.drawRect(module.tab.getPosX() + 6, y + 16, module.tab.getPosX() + 84, y + 16.5, new Color(195, 195, 195, 220).getRGB()); - Fonts.SF.SF_16.SF_16.drawString(textValue.getName(), module.tab.getPosX() + 5.5f, y + 1.5f, new Color(227, 227, 227, 255).getRGB()); + Fonts.fontSFUI35.drawString(textValue.getName(), module.tab.getPosX() + 5.5f, y + 1.5f, new Color(227, 227, 227, 255).getRGB()); - if (Fonts.SF.SF_16.SF_16.stringWidth(s) > 65) { - Fonts.SF.SF_16.SF_16.drawString(Fonts.SF.SF_16.SF_16.trimStringToWidth(s, 78, true), module.tab.getPosX() + 6, y + 10, 0xFFFFFFFF); + if (Fonts.fontSFUI35.getStringWidth(s) > 65) { + Fonts.fontSFUI35.drawString(Fonts.fontSFUI35.trimStringToWidth(s, 78, true), module.tab.getPosX() + 6, y + 10, 0xFFFFFFFF); } else { - Fonts.SF.SF_16.SF_16.drawString(s, module.tab.getPosX() + 6, y + 10, 0xFFFFFFFF); + Fonts.fontSFUI35.drawString(s, module.tab.getPosX() + 6, y + 10, 0xFFFFFFFF); } } diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Tab.java b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Tab.java index 2d95da81c2..444a920bc9 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Tab.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/clickgui/style/styles/classic/Tab.java @@ -7,7 +7,7 @@ import net.ccbluex.liquidbounce.FDPClient; import net.ccbluex.liquidbounce.features.module.ModuleCategory; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.impl.Fonts; +import net.ccbluex.liquidbounce.ui.font.Fonts; import net.ccbluex.liquidbounce.utils.render.RenderUtils; import java.awt.*; @@ -51,11 +51,11 @@ public void drawScreen(int mouseX, int mouseY) { l = "E"; } RenderUtils.drawRect(posX - 1, posY, posX + 101, posY + 15, new Color(29, 29, 29, 255).getRGB()); - Fonts.ICONFONT.ICONFONT_24.ICONFONT_24.drawString(l, posX + 88, posY + 5, 0xffffffff); + Fonts.ICONFONT_50.drawString(l, posX + 88, posY + 5, 0xffffffff); if (enumModuleType.name().equalsIgnoreCase("World")){ - Fonts.CheckFont.CheckFont_24.CheckFont_24.drawString("b",posX + 88, posY + 5, 0xffffffff); + Fonts.fontCheck42.drawString("b",posX + 88, posY + 5, 0xffffffff); } - Fonts.SF.SF_20.SF_20.drawString(enumModuleType.name().charAt(0) + enumModuleType.name().substring(1).toLowerCase(), posX + 4, posY + 4, 0xffffffff, true); + Fonts.fontSFUI35.drawString(enumModuleType.name().charAt(0) + enumModuleType.name().substring(1).toLowerCase(), posX + 4, posY + 4, 0xffffffff, true); if (opened) { RenderUtils.drawRect(posX - 1, posY + 15, posX + 101, posY + 15 + getTabHeight() + 1, new Color(29, 29, 29, 255).getRGB()); modules.forEach(module -> module.drawScreen(mouseX, mouseY)); diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/elements/Indicators.java b/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/elements/Indicators.java index 2ceec2d092..e838582d3d 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/elements/Indicators.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/elements/Indicators.java @@ -68,7 +68,7 @@ public Border drawElement(float partialTicks) { RenderUtils.drawNewRect(xX + 44, yX + 237 - 406, xX + 95, yX + 240.5 - 406, new Color(41, 41, 41, 255).getRGB()); RenderUtils.drawNewRect(xX + 5, yX + 197 - 405, xX + 100, yX + 198 - 405, mainColor().getRGB()); - Fonts.SFUI35.drawString("Indicators", xX + 37, yX + 202 - 406, -1); + Fonts.fontSFUI35.drawString("Indicators", xX + 37, yX + 202 - 406, -1); // armor final float armorValue = mc.thePlayer.getTotalArmorValue(); @@ -79,7 +79,7 @@ public Border drawElement(float partialTicks) { this.armorBarWidth = AnimationHelper.animate(armorWidth, this.armorBarWidth, 0.0229999852180481); RenderUtils.drawRect(xX + 44, yX + 210 - 406, xX + 44 + this.armorBarWidth, yX + 213.5 - 406, mainColor().getRGB()); - Fonts.SFUI35.drawString("Armor", xX + 8, yX + 211 - 406, -1); + Fonts.fontSFUI35.drawString("Armor", xX + 8, yX + 211 - 406, -1); // HurtTime double hurttimePercentage = MathHelper.clamp_double(mc.thePlayer.hurtTime, 0.0, 0.6); @@ -87,7 +87,7 @@ public Border drawElement(float partialTicks) { this.hurttimeBarWidth = AnimationHelper.animate(hurttimeWidth, this.hurttimeBarWidth, 0.0429999852180481); RenderUtils.drawRect(xX + 44, yX + 219 - 406, xX + 44 + this.hurttimeBarWidth, yX + 222.5 - 406, mainColor().getRGB()); - Fonts.SFUI35.drawString("HurtTime", xX + 8, yX + 220 - 406, -1); + Fonts.fontSFUI35.drawString("HurtTime", xX + 8, yX + 220 - 406, -1); // HurtTime double bpsPercentage = MathHelper.clamp_double(currSpeed, 0.0, 1.0); @@ -96,7 +96,7 @@ public Border drawElement(float partialTicks) { RenderUtils.drawRect(xX + 44, yX + 228 - 406, xX + 44 + this.bpsBarWidth, yX + 231.5 - 406, mainColor().getRGB()); - Fonts.SFUI35.drawString("BPS", xX + 8, yX + 229 - 406, -1); + Fonts.fontSFUI35.drawString("BPS", xX + 8, yX + 229 - 406, -1); // HurtTime final float health = mc.thePlayer.getHealth(); @@ -112,7 +112,7 @@ public Border drawElement(float partialTicks) { RenderUtils.drawRect(xX + 44, yX + 237 - 406, xX + 44 + this.healthBarWidth, yX + 240.5 - 406, mainColor().getRGB()); - Fonts.SFUI35.drawString("HP", xX + 8, yX + 238 - 406, -1); + Fonts.fontSFUI35.drawString("HP", xX + 8, yX + 238 - 406, -1); return new Border(xX + 5, yX + 198 - 405, xX + 100, yX + 246 - 408); } } \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/elements/Targets.kt b/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/elements/Targets.kt index 715a33d571..134bec9d3a 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/elements/Targets.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/client/hud/element/elements/Targets.kt @@ -1761,7 +1761,7 @@ open class Targets : Element(-46.0, -40.0, 1F, Side(Side.Horizontal.MIDDLE, Side GL11.glScalef(1F - calcScaleX, 1F - calcScaleY, 1F - calcScaleX) } // the part to blur for the epic glow - val font = Fonts.SFUI40 + val font = Fonts.fontSFUI40 val name = "Name: ${entity.name}" val info = "Distance: ${decimalFormat2.format(mc.thePlayer.getDistanceToEntityBox(entity))}" val length = (font.getStringWidth(name).coerceAtLeast(font.getStringWidth(info)).toFloat() + 40F).coerceAtLeast(125F) @@ -1775,7 +1775,7 @@ open class Targets : Element(-46.0, -40.0, 1F, Side(Side.Horizontal.MIDDLE, Side GL11.glScalef(1F - calcScaleX, 1F - calcScaleY, 1F - calcScaleX) } // the part to cut - val font = Fonts.SFUI40 + val font = Fonts.fontSFUI40 val name = "Name: ${entity.name}" val info = "Distance: ${decimalFormat2.format(mc.thePlayer.getDistanceToEntityBox(entity))}" val length = (font.getStringWidth(name).coerceAtLeast(font.getStringWidth(info)).toFloat() + 40F).coerceAtLeast(125F) diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/font/Fonts.java b/src/main/java/net/ccbluex/liquidbounce/ui/font/Fonts.java index efb57cd9f4..4df872e5ca 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/font/Fonts.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/font/Fonts.java @@ -11,8 +11,6 @@ import net.ccbluex.liquidbounce.utils.FileUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.util.ResourceLocation; - import java.awt.*; import java.io.*; import java.lang.reflect.Field; @@ -21,17 +19,16 @@ public class Fonts { + + @FontDetails(fontName = "Medium", fontSize = 40, fileName = "regular.ttf") + public static GameFontRenderer font40; + + @FontDetails(fontName = "Small", fontSize = 35, fileName = "regular.ttf") + public static GameFontRenderer font35; @FontDetails(fontName = "Light", fontSize = 32, fileName = "regular.ttf") public static GameFontRenderer font32; @FontDetails(fontName = "superLight", fontSize = 28, fileName = "regular.ttf") public static GameFontRenderer font28; - - @FontDetails(fontName = "Roboto Medium", fontSize = 35) - public static GameFontRenderer font35; - - @FontDetails(fontName = "Roboto Medium", fontSize = 40) - public static GameFontRenderer font40; - @FontDetails(fontName = "Roboto Medium", fontSize = 72) public static GameFontRenderer font72; @@ -44,49 +41,39 @@ public class Fonts { @FontDetails(fontName = "Roboto Medium", fontSize = 52) public static GameFontRenderer fontLarge; - @FontDetails(fontName = "SF", fontSize = 40) - public static GameFontRenderer SF; - - @FontDetails(fontName = "SFUI40", fontSize = 20) - public static GameFontRenderer SFUI40; - - @FontDetails(fontName = "SFUI35", fontSize = 18) - public static GameFontRenderer SFUI35; - - @FontDetails(fontName = "SFUI10", fontSize = 10) - public static GameFontRenderer SFUI10; - + @FontDetails(fontName = "SFUI Regular", fontSize = 32) + public static GameFontRenderer fontSFUI32; @FontDetails(fontName = "SFUI Regular", fontSize = 35) public static GameFontRenderer fontSFUI35; @FontDetails(fontName = "SFUI Regular", fontSize = 40) public static GameFontRenderer fontSFUI40; - @FontDetails(fontName = "Tahoma", fontSize = 35) + @FontDetails(fontName = "Tahoma Bold", fontSize = 35) public static GameFontRenderer fontTahoma; - @FontDetails(fontName = "Tahoma", fontSize = 30) + @FontDetails(fontName = "Tahoma Bold", fontSize = 30) public static GameFontRenderer fontTahoma30; + @FontDetails(fontName = "mainmenu", fontSize = 30) + public static GameFontRenderer fontMainMenu60; + @FontDetails(fontName = "Check", fontSize = 42) + public static GameFontRenderer fontCheck42; public static TTFFontRenderer fontTahomaSmall; - - @FontDetails(fontName = "Bangers", fontSize = 45) - public static GameFontRenderer fontBangers; - - @FontDetails(fontName = "ICONFONT_50", fontSize = 50) + @FontDetails(fontName = "ICONFONT", fontSize = 50) public static GameFontRenderer ICONFONT_50; - @FontDetails(fontName = "Minecraft Font") - public static final FontRenderer minecraftFont = Minecraft.getMinecraft().fontRendererObj; - - @FontDetails(fontName = "Tenacity35", fontSize = 35) + @FontDetails(fontName = "Tenacity", fontSize = 35) public static GameFontRenderer fontTenacity35; - @FontDetails(fontName = "TenacityBold35", fontSize = 35) + @FontDetails(fontName = "Tenacity", fontSize = 40) + public static GameFontRenderer fontTenacity40; + + @FontDetails(fontName = "Tenacity Bold", fontSize = 35) public static GameFontRenderer fontTenacityBold35; - @FontDetails(fontName = "tenacity40", fontSize = 40) - public static GameFontRenderer fontTenacity40; + @FontDetails(fontName = "Minecraft Font") + public static final FontRenderer minecraftFont = Minecraft.getMinecraft().fontRendererObj; private static final List CUSTOM_FONT_RENDERERS = new ArrayList<>(); @@ -95,27 +82,26 @@ public static void loadFonts() { ClientUtils.INSTANCE.logInfo("Loading Fonts."); - SF = new GameFontRenderer(getFont("SF.ttf", 20)); - SFUI40 = new GameFontRenderer(getFont("SF.ttf", 20)); - SFUI35 = new GameFontRenderer(getFont("SF.ttf", 18)); - SFUI10 = new GameFontRenderer(getFont("SF.ttf", 10)); - fontSFUI35 = new GameFontRenderer(getFont("sfui.ttf", 35)); - fontSFUI40 = new GameFontRenderer(getFont("sfui.ttf", 40)); - font35 = new GameFontRenderer(getFont("Roboto-Medium.ttf", 35)); - font40 = new GameFontRenderer(getFont("Roboto-Medium.ttf", 40)); - font72 = new GameFontRenderer(getFont("Roboto-Medium.ttf", 72)); + font40 = new GameFontRenderer(getFont("regular.ttf", 40)); + font35 = new GameFontRenderer(getFont("regular.ttf", 35)); + font32 = new GameFontRenderer(getFont("regular.ttf", 32)); + font28 = new GameFontRenderer(getFont("regular.ttf", 28)); fontSmall = new GameFontRenderer(getFont("Roboto-Medium.ttf", 30)); + font72 = new GameFontRenderer(getFont("Roboto-Medium.ttf", 72)); fontTiny = new GameFontRenderer(getFont("Roboto-Medium.ttf", 24)); fontLarge = new GameFontRenderer(getFont("Roboto-Medium.ttf", 60)); - ICONFONT_50 = new GameFontRenderer(getFont("stylesicons.ttf", 50)); + fontSFUI32 = new GameFontRenderer(getFont("sfui.ttf", 32)); + fontSFUI35 = new GameFontRenderer(getFont("sfui.ttf", 35)); + fontSFUI40 = new GameFontRenderer(getFont("sfui.ttf", 40)); + fontTahoma = new GameFontRenderer(getFont("TahomaBold.ttf", 35)); + fontTahoma30 = new GameFontRenderer(getFont("TahomaBold.ttf", 30)); fontTahomaSmall = new TTFFontRenderer(getFont("Tahoma.ttf", 11)); - fontBangers = new GameFontRenderer(getFontcustom(45, "Bangers")); - fontTahoma = new GameFontRenderer(getFontcustom(35,"Tahoma")); - fontTahoma30 = new GameFontRenderer(getFontcustom(30,"Tahoma")); - fontTenacity35 = new GameFontRenderer(getFontcustom(35, "tenacity")); - fontTenacityBold35 = new GameFontRenderer(getFontcustom(35, "tenacity-bold")); - fontTenacity40 = new GameFontRenderer(getFontcustom(40,"tenacity")); - + ICONFONT_50 = new GameFontRenderer(getFont("stylesicons.ttf", 50)); + fontTenacityBold35 = new GameFontRenderer(getFont("tenacity-bold.ttf", 35)); + fontTenacity35 = new GameFontRenderer(getFont("tenacity.ttf", 35)); + fontTenacity40 = new GameFontRenderer(getFont("tenacity.ttf", 40)); + fontMainMenu60 = new GameFontRenderer(getFont("mainmenu.ttf", 60)); + fontCheck42 = new GameFontRenderer(getFont("check.ttf", 42)); getCustomFonts(); initFonts(); @@ -171,29 +157,14 @@ public static void loadFonts() { private static void initFonts() { try { - initSingleFont("regular.ttf", "assets/minecraft/fdpclient/font/regular.ttf"); + initSingleFont("assets/minecraft/fdpclient/font/regular.ttf"); }catch(IOException e) { e.printStackTrace(); } } - private static Font getFontcustom(int size,String fontname) { - Font font; - try { - InputStream is = Minecraft.getMinecraft().getResourceManager() - .getResource(new ResourceLocation("fdpclient/font/"+fontname+".ttf")).getInputStream(); - font = Font.createFont(0, is); - font = font.deriveFont(Font.PLAIN, size); - } catch (Exception ex) { - ex.printStackTrace(); - System.out.println("Error loading font"); - font = new Font("default", Font.PLAIN, size); - } - return font; - } - - private static void initSingleFont(String name, String resourcePath) throws IOException { - File file=new File(FDPClient.fileManager.getFontsDir(), name); + private static void initSingleFont(String resourcePath) throws IOException { + File file=new File(FDPClient.fileManager.getFontsDir(), "regular.ttf"); if(!file.exists()) FileUtils.INSTANCE.unpackFile(file, resourcePath); } diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/font/GameFontRenderer.kt b/src/main/java/net/ccbluex/liquidbounce/ui/font/GameFontRenderer.kt index 3d840ac19d..8053874034 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/font/GameFontRenderer.kt +++ b/src/main/java/net/ccbluex/liquidbounce/ui/font/GameFontRenderer.kt @@ -390,16 +390,6 @@ class GameFontRenderer(font: Font) : FontRenderer(Minecraft.getMinecraft().gameS override fun bindTexture(location: ResourceLocation?) {} - fun drawOutlineStringWithoutGL(s: String, x: Float, y: Float, color: Int,font: FontRenderer) { - - font.drawString(ColorUtils.stripColor(s), (x * 2 - 1).toInt(), (y * 2).toInt(), Color.BLACK.rgb) - font.drawString(ColorUtils.stripColor(s), (x * 2 + 1).toInt(), (y * 2).toInt(), Color.BLACK.rgb) - font.drawString(ColorUtils.stripColor(s), (x * 2).toInt(), (y * 2 - 1).toInt(), Color.BLACK.rgb) - font.drawString(ColorUtils.stripColor(s), (x * 2).toInt(), (y * 2 + 1).toInt(), Color.BLACK.rgb) - font.drawString(s, (x * 2).toInt(), (y * 2).toInt(), color) - } - - companion object { @JvmStatic fun getColorIndex(type: Char): Int { diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/font/TTFFontRenderer.java b/src/main/java/net/ccbluex/liquidbounce/ui/font/TTFFontRenderer.java index 8039adde45..33ecc5e1ce 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/font/TTFFontRenderer.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/font/TTFFontRenderer.java @@ -5,7 +5,6 @@ */ package net.ccbluex.liquidbounce.ui.font; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.api.FontRenderer; import net.ccbluex.liquidbounce.utils.render.ColorUtils; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.MathHelper; @@ -251,14 +250,6 @@ public void drawStringWithShadow(String text, float x, float y, int color) { renderString(text, x, y, color, false); } - public static void drawOutlineStringWithoutGL(String s, float x, float y, int color, FontRenderer fontRenderer) { - fontRenderer.drawString(ColorUtils.stripColor(s), (int) (x * 2 - 1), (int) (y * 2), Color.BLACK.getRGB()); - fontRenderer.drawString(ColorUtils.stripColor(s), (int) (x * 2 + 1), (int) (y * 2), Color.BLACK.getRGB()); - fontRenderer.drawString(ColorUtils.stripColor(s), (int) (x * 2), (int) (y * 2 - 1), Color.BLACK.getRGB()); - fontRenderer.drawString(ColorUtils.stripColor(s), (int) (x * 2), (int) (y * 2 + 1), Color.BLACK.getRGB()); - fontRenderer.drawString(s, (int) (x * 2), (int) (y * 2), color); - } - /** diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/CFont.java b/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/CFont.java index 004c47e050..49022763d3 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/CFont.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/CFont.java @@ -3,15 +3,17 @@ * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. * https://github.com/SkidderMC/FDPClient/ */ - package net.ccbluex.liquidbounce.ui.font.cf; -import net.minecraft.client.renderer.texture.DynamicTexture; -import org.lwjgl.opengl.GL11; - -import java.awt.*; +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import net.minecraft.client.renderer.texture.DynamicTexture; +import org.lwjgl.opengl.GL11; public class CFont { protected Font font; @@ -19,9 +21,9 @@ public class CFont { protected boolean fractionalMetrics; protected DynamicTexture tex; private final float imgSize = 512.0f; - protected final CharData[] charData = new CharData[256]; + protected CharData[] charData = new CharData[256]; protected int fontHeight = -1; - protected final int charOffset = 0; + protected int charOffset = 0; public CFont(Font font, boolean antiAlias, boolean fractionalMetrics) { this.font = font; @@ -93,28 +95,32 @@ protected void drawQuad(float x, float y, float width, float height, float srcX, float renderSRCWidth = srcWidth / 512.0f; float renderSRCHeight = srcHeight / 512.0f; GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY); - GL11.glVertex2d(x + width, y); + GL11.glVertex2d((double) (x + width), (double) y); GL11.glTexCoord2f(renderSRCX, renderSRCY); - GL11.glVertex2d(x, y); + GL11.glVertex2d((double) x, (double) y); GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight); - GL11.glVertex2d(x, y + height); + GL11.glVertex2d((double) x, (double) (y + height)); GL11.glTexCoord2f(renderSRCX, renderSRCY + renderSRCHeight); - GL11.glVertex2d(x, y + height); + GL11.glVertex2d((double) x, (double) (y + height)); GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY + renderSRCHeight); - GL11.glVertex2d(x + width, y + height); + GL11.glVertex2d((double) (x + width), (double) (y + height)); GL11.glTexCoord2f(renderSRCX + renderSRCWidth, renderSRCY); - GL11.glVertex2d(x + width, y); + GL11.glVertex2d((double) (x + width), (double) y); + } + + public int getStringHeight(String text) { + return getHeight(); } - public double getHeight() { + public int getHeight() { return (this.fontHeight - 8) / 2; } - public double getStringWidth(String text) { + public int getStringWidth(String text) { int width = 0; char[] arrc = text.toCharArray(); for (char c : arrc) { - if (c < this.charData.length) { + if (c < this.charData.length && c >= 0) { width += (this.charData[c].width - 8) + this.charOffset; } } @@ -152,8 +158,7 @@ public void setFont(Font font) { this.tex = setupTexture(font, this.antiAlias, this.fractionalMetrics, this.charData); } - /* loaded from: LiquidBounce-b73.jar:net/ccbluex/liquidbounce/CFont$CharData.class */ - protected static class CharData { + protected class CharData { public int width; public int height; public int storedX; diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/CFontRenderer.java b/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/CFontRenderer.java index 895fa682cb..0f1706ad24 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/CFontRenderer.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/CFontRenderer.java @@ -284,7 +284,7 @@ public static int getColor(String str) { /* JADX WARN: Type inference failed for: r0v55, types: [double] */ public float drawString(String text, float x, float y, int color, boolean shadow) { - return drawString(text, (double) x, (double) y,color,shadow); + return drawString(text, x, (double) y,color,shadow); } public float drawString(String text, double x, double y, int color, boolean shadow) { GlStateManager.enableBlend(); @@ -380,7 +380,7 @@ public float drawString(String text, double x, double y, int color, boolean shad i++; } else if (character < currentData.length) { GL11.glBegin(4); - drawChar(currentData, character, (float) c, (float) y2); + drawChar(currentData, character, c, (float) y2); GL11.glEnd(); if (strikethrough) { drawLine(c, y2 + ((double) (currentData[character].height / 2)), (c + ((double) currentData[character].width)) - 8.0d, y2 + ((double) (currentData[character].height / 2))); @@ -490,7 +490,7 @@ public int drawStringi(String text, double x, double y, int color, boolean shado i++; } else if (character < currentData.length) { GL11.glBegin(4); - drawChar(currentData, character, (float) c, (float) y2); + drawChar(currentData, character, c, (float) y2); GL11.glEnd(); if (strikethrough) { drawLine(c, y2 + ((double) (currentData[character].height / 2)), (c + ((double) currentData[character].width)) - 8.0d, y2 + ((double) (currentData[character].height / 2))); @@ -498,7 +498,7 @@ public int drawStringi(String text, double x, double y, int color, boolean shado if (underline) { drawLine(c, (y2 + ((double) currentData[character].height)) - 2.0d, (c + ((double) currentData[character].width)) - 8.0d, (y2 + ((double) currentData[character].height)) - 2.0d); } - c += (double) ((currentData[character].width - 8) + this.charOffset); + c += (char) ((currentData[character].width - 8) + this.charOffset); } i++; } @@ -507,8 +507,8 @@ public int drawStringi(String text, double x, double y, int color, boolean shado return ((int) c) / 2; } - @Override // net.ccbluex.liquidbounce.CFont - public double getStringWidth(String text) { + @Override + public int getStringWidth(String text) { if (text == null) { return 0; } @@ -533,7 +533,7 @@ public double getStringWidth(String text) { return width / 2; } - @Override // net.ccbluex.liquidbounce.CFont + @Override public void setFont(Font font) { setFont(font); setupBoldItalicIDs(); diff --git a/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/FontLoaders.java b/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/FontLoaders.java index 90a6bad974..54ceecde13 100644 --- a/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/FontLoaders.java +++ b/src/main/java/net/ccbluex/liquidbounce/ui/font/cf/FontLoaders.java @@ -1,18 +1,15 @@ -/* - * FDPClient Hacked Client - * A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge by LiquidBounce. - * https://github.com/SkidderMC/FDPClient/ - */ - package net.ccbluex.liquidbounce.ui.font.cf; -import net.ccbluex.liquidbounce.ui.font.cf.CFontRenderer; +import net.ccbluex.liquidbounce.utils.MinecraftInstance; import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; import java.awt.*; +import java.io.InputStream; import java.util.ArrayList; + public abstract class FontLoaders { + public static final CFontRenderer F14 = new CFontRenderer(getFont(14), true, true); public static final CFontRenderer F18 = new CFontRenderer(getFont(18), true, true); public static final CFontRenderer F20 = new CFontRenderer(getFont(20), true, true); @@ -24,6 +21,49 @@ public abstract class FontLoaders { public static final CFontRenderer M16 = new CFontRenderer(getMojangles(16), true, true); public static final ArrayList fonts = new ArrayList<>(); + // Tahoma2 + public static CFontRenderer Tahoma9 = new CFontRenderer(FontLoaders.getTahoma(9), true, true); + public static CFontRenderer Tahoma11 = new CFontRenderer(FontLoaders.getTahoma(11), true, true); + public static CFontRenderer Tahoma13 = new CFontRenderer(FontLoaders.getTahoma(13), true, true); + public static CFontRenderer Tahoma14 = new CFontRenderer(FontLoaders.getTahoma(14), true, true); + public static CFontRenderer Tahoma16 = new CFontRenderer(FontLoaders.getTahoma(16), true, true); + public static CFontRenderer Tahoma18 = new CFontRenderer(FontLoaders.getTahoma(18), true, true); + public static CFontRenderer Tahoma17 = new CFontRenderer(FontLoaders.getTahoma(17), true, true); + public static CFontRenderer Tahoma19 = new CFontRenderer(FontLoaders.getTahoma(19), true, true); + public static CFontRenderer Tahoma21 = new CFontRenderer(FontLoaders.getTahoma(21), true, true); + public static CFontRenderer Tahoma22 = new CFontRenderer(FontLoaders.getTahoma(22), true, true); + public static CFontRenderer Tahoma24 = new CFontRenderer(FontLoaders.getTahoma(24), true, true); + public static CFontRenderer Tahoma23 = new CFontRenderer(FontLoaders.getTahoma(23), true, true); + public static CFontRenderer Tahoma20 = new CFontRenderer(FontLoaders.getTahoma(20), true, true); + + // Tahoma3 + public static CFontRenderer TahomaBold8 = new CFontRenderer(FontLoaders.getTahomaBold(8), true, true); + public static CFontRenderer TahomaBold9 = new CFontRenderer(FontLoaders.getTahomaBold(9), true, true); + public static CFontRenderer TahomaBold10 = new CFontRenderer(FontLoaders.getTahomaBold(10), true, true); + public static CFontRenderer TahomaBold11 = new CFontRenderer(FontLoaders.getTahomaBold(11), true, true); + public static CFontRenderer TahomaBold12 = new CFontRenderer(FontLoaders.getTahomaBold(12), true, true); + public static CFontRenderer TahomaBold13 = new CFontRenderer(FontLoaders.getTahomaBold(13), true, true); + public static CFontRenderer TahomaBold14 = new CFontRenderer(FontLoaders.getTahomaBold(14), true, true); + public static CFontRenderer TahomaBold16 = new CFontRenderer(FontLoaders.getTahomaBold(16), true, true); + public static CFontRenderer TahomaBold17 = new CFontRenderer(FontLoaders.getTahomaBold(17), true, true); + public static CFontRenderer TahomaBold18 = new CFontRenderer(FontLoaders.getTahomaBold(18), true, true); + public static CFontRenderer TahomaBold19 = new CFontRenderer(FontLoaders.getTahomaBold(19), true, true); + public static CFontRenderer TahomaBold20 = new CFontRenderer(FontLoaders.getTahomaBold(20), true, true); + public static CFontRenderer TahomaBold21 = new CFontRenderer(FontLoaders.getTahomaBold(21), true, true); + public static CFontRenderer TahomaBold22 = new CFontRenderer(FontLoaders.getTahomaBold(22), true, true); + public static CFontRenderer TahomaBold23 = new CFontRenderer(FontLoaders.getTahomaBold(23), true, true); + public static CFontRenderer TahomaBold24 = new CFontRenderer(FontLoaders.getTahomaBold(24), true, true); + + public static CFontRenderer SF16 = new CFontRenderer(FontLoaders.getSF(16), true, true); + public static CFontRenderer SF17 = new CFontRenderer(FontLoaders.getSF(17), true, true); + public static CFontRenderer SF18 = new CFontRenderer(FontLoaders.getSF(18), true, true); + public static CFontRenderer SF19 = new CFontRenderer(FontLoaders.getSF(19), true, true); + public static CFontRenderer SF20 = new CFontRenderer(FontLoaders.getSF(20), true, true); + public static CFontRenderer SF21 = new CFontRenderer(FontLoaders.getSF(21), true, true); + public static CFontRenderer SF22 = new CFontRenderer(FontLoaders.getSF(22), true, true); + public static CFontRenderer SF23 = new CFontRenderer(FontLoaders.getSF(23), true, true); + public static CFontRenderer SF24 = new CFontRenderer(FontLoaders.getSF(24), true, true); + public static Font getFont(int size) { Font font; try { @@ -36,10 +76,13 @@ public static Font getFont(int size) { return font; } - public static Font getComfortaa(int size) { + private static Font getComfortaa(int size) { Font font; try { - font = Font.createFont(0, Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("fdpclient/font/regular.ttf")).getInputStream()).deriveFont(Font.PLAIN, (float) size); + InputStream is = MinecraftInstance.mc.getResourceManager() + .getResource(new ResourceLocation("fdpclient/font/Comfortaa.ttf")).getInputStream(); + font = Font.createFont(0, is); + font = font.deriveFont(Font.PLAIN, size); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Error loading font"); @@ -48,10 +91,13 @@ public static Font getComfortaa(int size) { return font; } - public static Font getMojangles(int size) { + private static Font getMojangles(int size) { Font font; try { - font = Font.createFont(0, Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("fdpclient/font/mojangles.ttf")).getInputStream()).deriveFont(Font.PLAIN, (float) size); + InputStream is = MinecraftInstance.mc.getResourceManager() + .getResource(new ResourceLocation("fdpclient/font/mojangles.ttf")).getInputStream(); + font = Font.createFont(0, is); + font = font.deriveFont(Font.PLAIN, size); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Error loading font"); @@ -59,4 +105,66 @@ public static Font getMojangles(int size) { } return font; } -} + + private static Font getSF(int size) { + Font font; + try { + InputStream is = MinecraftInstance.mc.getResourceManager() + .getResource(new ResourceLocation("fdpclient/font/sfui.ttf")).getInputStream(); + font = Font.createFont(0, is); + font = font.deriveFont(Font.PLAIN, size); + } catch (Exception ex) { + ex.printStackTrace(); + System.out.println("Error loading font"); + font = new Font("default", Font.PLAIN, size); + } + return font; + } + + private static Font getExhibition(int size) { + Font font; + try { + InputStream is = MinecraftInstance.mc.getResourceManager() + .getResource(new ResourceLocation("fdpclient/font/Icons.ttf")).getInputStream(); + font = Font.createFont(0, is); + font = font.deriveFont(Font.PLAIN, size); + } catch (Exception ex) { + ex.printStackTrace(); + System.out.println("Error loading font"); + font = new Font("default", Font.PLAIN, size); + } + return font; + } + + + private static Font getTahoma(int size) { + Font font; + try { + InputStream is = MinecraftInstance.mc.getResourceManager() + .getResource(new ResourceLocation("fdpclient/font/Tahoma.ttf")).getInputStream(); + font = Font.createFont(0, is); + font = font.deriveFont(Font.PLAIN, size); + } catch (Exception ex) { + ex.printStackTrace(); + System.out.println("Error loading font"); + font = new Font("default", Font.PLAIN, size); + } + return font; + } + + private static Font getTahomaBold(int size) { + Font font; + try { + InputStream is = MinecraftInstance.mc.getResourceManager() + .getResource(new ResourceLocation("fdpclient/font/TahomaBold.ttf")).getInputStream(); + font = Font.createFont(0, is); + font = font.deriveFont(Font.PLAIN, size); + } catch (Exception ex) { + ex.printStackTrace(); + System.out.println("Error loading font"); + font = new Font("default", Font.PLAIN, size); + } + return font; + } + +} \ No newline at end of file diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/CustomSplashProgress.java b/src/main/java/net/ccbluex/liquidbounce/utils/CustomSplashProgress.java index b7b7736165..e2f9b0d879 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/CustomSplashProgress.java +++ b/src/main/java/net/ccbluex/liquidbounce/utils/CustomSplashProgress.java @@ -7,7 +7,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.FileResourcePack; import net.minecraft.client.resources.FolderResourcePack; import net.minecraft.client.resources.IResourcePack; @@ -26,11 +25,9 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.SharedDrawable; import org.lwjgl.util.glu.GLU; - import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream; -import java.awt.*; import java.awt.image.BufferedImage; import java.io.*; import java.nio.ByteBuffer; @@ -41,31 +38,22 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import static org.lwjgl.opengl.GL11.glLoadIdentity; + public class CustomSplashProgress { private static Drawable d; private static volatile boolean pause = false; private static volatile boolean done = false; private static Thread thread; private static volatile Throwable threadError; - private static final int angle = 0; private static final Lock lock = new ReentrantLock(true); - private static CustomSplashProgress.SplashFontRenderer fontRenderer; private static final IResourcePack mcPack; private static final IResourcePack fmlPack; private static IResourcePack miscPack; private static CustomSplashProgress.Texture fontTexture; - //private static CustomSplashProgress.Texture logoTexture; private static CustomSplashProgress.Texture backgroundTexture; - //private static CustomSplashProgress.Texture forgeTexture; private static Properties config; private static boolean enabled; - private static boolean rotate; - //private static int logoOffset; - //private static int backgroundColor; - private static int fontColor; - private static int barBorderColor; - private static int barColor; - private static int barBackgroundColor; public static final Semaphore mutex; private static int max_texture_size; private static final IntBuffer buf; @@ -76,16 +64,8 @@ private static String getString(String name, String def) { return value; } - private static boolean getBool(String name, boolean def) { - return Boolean.parseBoolean(getString(name, Boolean.toString(def))); - } - - private static int getInt(String name, int def) { - return Integer.decode(getString(name, Integer.toString(def))); - } - - private static int getHex(String name, int def) { - return Integer.decode(getString(name, "0x" + Integer.toString(def, 16).toUpperCase())); + private static boolean getBool(boolean def) { + return Boolean.parseBoolean(getString("enabled", Boolean.toString(def))); } public static void start() { @@ -102,27 +82,15 @@ public static void start() { r = new FileReader(configFile); config.load(r); } catch (IOException var24) { - FMLLog.info("Could not load splash.properties, will create a default one", new Object[0]); + FMLLog.info("Could not load splash.properties, will create a default one"); } finally { IOUtils.closeQuietly(r); } boolean defaultEnabled = !System.getProperty("os.name").toLowerCase().contains("mac"); - enabled = getBool("enabled", defaultEnabled) && (!FMLClientHandler.instance().hasOptifine() || Launch.blackboard.containsKey("optifine.ForgeSplashCompatible")); - rotate = getBool("rotate", false); - //logoOffset = getInt("logoOffset", 0); - //backgroundColor = getHex("background", 16777215); - //fontColor = getHex("font", 0); - fontColor = Color.WHITE.getRGB(); - barBorderColor = getHex("barBorder", 12632256); - //barColor = getHex("bar", 13319477); - barColor = new Color(200, 0, 255, 180).getRGB(); - //barBackgroundColor = getHex("barBackground", 16777215); - barBackgroundColor = new Color(200, 200, 255).getRGB(); + enabled = getBool(defaultEnabled) && (!FMLClientHandler.instance().hasOptifine() || Launch.blackboard.containsKey("optifine.ForgeSplashCompatible")); final ResourceLocation fontLoc = new ResourceLocation(getString("fontTexture", "minecraft:textures/font/ascii.png")); - final ResourceLocation logoLoc = new ResourceLocation(getString("logoTexture", "minecraft:textures/gui/title/mojang.png")); final ResourceLocation backgroundLoc = new ResourceLocation(getString("backgroundTexture", "fdpclient/misc/splash.png")); - final ResourceLocation forgeLoc = new ResourceLocation(getString("forgeTexture", "fml:textures/gui/forge.gif")); File miscPackFile = new File(Minecraft.getMinecraft().mcDataDir, getString("resourcePackPath", "resources")); FileWriter w = null; @@ -130,7 +98,7 @@ public static void start() { w = new FileWriter(configFile); config.store(w, "Splash screen properties"); } catch (IOException var22) { - FMLLog.log(Level.ERROR, var22, "Could not save the splash.properties file", new Object[0]); + FMLLog.log(Level.ERROR, var22, "Could not save the splash.properties file"); } finally { IOUtils.closeQuietly(w); } @@ -138,7 +106,7 @@ public static void start() { miscPack = createResourcePack(miscPackFile); if (enabled) { FMLCommonHandler.instance().registerCrashCallable(new ICrashCallable() { - public String call() throws Exception { + public String call() { return "' Vendor: '" + GL11.glGetString(7936) + "' Version: '" + GL11.glGetString(7938) + "' Renderer: '" + GL11.glGetString(7937) + "'"; } @@ -172,19 +140,12 @@ public void printStackTrace(PrintStream s) { getMaxTextureSize(); thread = new Thread(new Runnable() { - private final int barWidth = 400; - private final int barHeight = 20; - private final int textHeight2 = 20; - private final int barOffset = 55; - public void run() { this.setGL(); CustomSplashProgress.fontTexture = new CustomSplashProgress.Texture(fontLoc); - //CustomSplashProgress.logoTexture = new CustomSplashProgress.Texture(logoLoc); CustomSplashProgress.backgroundTexture = new CustomSplashProgress.Texture(backgroundLoc); - //CustomSplashProgress.forgeTexture = new CustomSplashProgress.Texture(forgeLoc); GL11.glEnable(3553); - CustomSplashProgress.fontRenderer = new CustomSplashProgress.SplashFontRenderer(); + new SplashFontRenderer(); GL11.glDisable(3553); for(; !CustomSplashProgress.done; Display.sync(100)) { @@ -207,26 +168,10 @@ public void run() { int h = Display.getHeight(); GL11.glViewport(0, 0, w, h); GL11.glMatrixMode(5889); - GL11.glLoadIdentity(); + glLoadIdentity(); GL11.glOrtho(320 - w / 2, 320 + w / 2, 240 + h / 2, 240 - h / 2, -1.0, 1.0); GL11.glMatrixMode(5888); - GL11.glLoadIdentity(); - - /*this.setColor(CustomSplashProgress.backgroundColor); - GL11.glEnable(3553); - CustomSplashProgress.logoTexture.bind(); - GL11.glBegin(7); - CustomSplashProgress.logoTexture.texCoord(0, 0.0F, 0.0F); - GL11.glVertex2f(64.0F, -16.0F); - CustomSplashProgress.logoTexture.texCoord(0, 0.0F, 1.0F); - GL11.glVertex2f(64.0F, 496.0F); - CustomSplashProgress.logoTexture.texCoord(0, 1.0F, 1.0F); - GL11.glVertex2f(576.0F, 496.0F); - CustomSplashProgress.logoTexture.texCoord(0, 1.0F, 0.0F); - GL11.glVertex2f(576.0F, -16.0F); - GL11.glEnd(); - GL11.glDisable(3553);*/ - + glLoadIdentity(); int w2 = Display.getWidth(); int h2 = Display.getHeight(); @@ -260,35 +205,6 @@ public void run() { GL11.glPopMatrix(); } - //this.setColor(CustomSplashProgress.backgroundColor); - - /*CustomSplashProgress.angle = CustomSplashProgress.angle + 1; - this.setColor(CustomSplashProgress.backgroundColor); - float fw = (float) CustomSplashProgress.forgeTexture.getWidth() / 2.0F / 2.0F; - float fh = (float) CustomSplashProgress.forgeTexture.getHeight() / 2.0F / 2.0F; - if (CustomSplashProgress.rotate) { - float sh = Math.max(fw, fh); - GL11.glTranslatef((float)(320 + w / 2) - sh - (float) CustomSplashProgress.logoOffset, (float)(240 + h / 2) - sh - (float) CustomSplashProgress.logoOffset, 0.0F); - GL11.glRotatef((float) CustomSplashProgress.angle, 0.0F, 0.0F, 1.0F); - } else { - GL11.glTranslatef((float)(320 + w / 2) - fw - (float) CustomSplashProgress.logoOffset, (float)(240 + h / 2) - fh - (float) CustomSplashProgress.logoOffset, 0.0F); - } - - int f = CustomSplashProgress.angle / 10 % CustomSplashProgress.forgeTexture.getFrames(); - GL11.glEnable(3553); - CustomSplashProgress.forgeTexture.bind(); - GL11.glBegin(7); - CustomSplashProgress.forgeTexture.texCoord(f, 0.0F, 0.0F); - GL11.glVertex2f(-fw, -fh); - CustomSplashProgress.forgeTexture.texCoord(f, 0.0F, 1.0F); - GL11.glVertex2f(-fw, fh); - CustomSplashProgress.forgeTexture.texCoord(f, 1.0F, 1.0F); - GL11.glVertex2f(fw, fh); - CustomSplashProgress.forgeTexture.texCoord(f, 1.0F, 0.0F); - GL11.glVertex2f(fw, -fh); - GL11.glEnd(); - GL11.glDisable(3553);*/ - CustomSplashProgress.mutex.acquireUninterruptibly(); Display.update(); @@ -302,36 +218,6 @@ public void run() { this.clearGL(); } - private void setColor(int color) { - GL11.glColor3ub((byte)(color >> 16 & 255), (byte)(color >> 8 & 255), (byte)(color & 255)); - } - - private void drawBox(int w, int h) { - double paramXStart = 0; - double paramYStart = 0; - double paramXEnd = w; - double paramYEnd = h; - double radius = (double) h / 2; - - double x1 = paramXStart + radius; - double y1 = paramYStart + radius; - double x2 = paramXEnd - radius; - double y2 = paramYEnd - radius; - - GL11.glBegin(GL11.GL_POLYGON); - - double degree = Math.PI / 180; - for (double i = 0; i <= 90; i += 1) - GL11.glVertex2d(x2 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius); - for (double i = 90; i <= 180; i += 1) - GL11.glVertex2d(x2 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius); - for (double i = 180; i <= 270; i += 1) - GL11.glVertex2d(x1 + Math.sin(i * degree) * radius, y1 + Math.cos(i * degree) * radius); - for (double i = 270; i <= 360; i += 1) - GL11.glVertex2d(x1 + Math.sin(i * degree) * radius, y2 + Math.cos(i * degree) * radius); - GL11.glEnd(); - } - private void setGL() { CustomSplashProgress.lock.lock(); @@ -342,7 +228,6 @@ private void setGL() { throw new RuntimeException(var2); } - //GL11.glClearColor((float)(CustomSplashProgress.backgroundColor >> 16 & 255) / 255.0F, (float)(CustomSplashProgress.backgroundColor >> 8 & 255) / 255.0F, (float)(CustomSplashProgress.backgroundColor & 255) / 255.0F, 1.0F); GL11.glDisable(2896); GL11.glDisable(2929); GL11.glEnable(3042); @@ -372,7 +257,7 @@ private void clearGL() { } }); thread.setUncaughtExceptionHandler((t, e) -> { - FMLLog.log(Level.ERROR, e, "Splash thread Exception", new Object[0]); + FMLLog.log(Level.ERROR, e, "Splash thread Exception"); CustomSplashProgress.threadError = e; }); thread.start(); @@ -380,19 +265,17 @@ private void clearGL() { } } - public static int getMaxTextureSize() { + public static void getMaxTextureSize() { if (max_texture_size != -1) { - return max_texture_size; } else { for(int i = 16384; i > 0; i >>= 1) { GL11.glTexImage2D(32868, 0, 6408, i, i, 0, 6408, 5121, (ByteBuffer)null); if (GL11.glGetTexLevelParameteri(32868, 0, 4096) != 0) { max_texture_size = i; - return i; + return; } } - return -1; } } @@ -448,8 +331,6 @@ public static void finish() { d.releaseContext(); Display.getDrawable().makeCurrent(); fontTexture.delete(); - //logoTexture.delete(); - //forgeTexture.delete(); } catch (Exception e) { e.printStackTrace(); disableSplash(e); @@ -458,7 +339,7 @@ public static void finish() { } } - private static boolean disableSplash(Exception e) { + private static void disableSplash(Exception e) { if (disableSplash()) { throw new EnhancedRuntimeException(e) { protected void printStackTrace(EnhancedRuntimeException.WrappedPrintStream stream) { @@ -491,37 +372,22 @@ private static boolean disableSplash() { config.setProperty("enabled", "false"); FileWriter w = null; - boolean var4; try { w = new FileWriter(configFile); config.store(w, "Splash screen properties"); return true; } catch (IOException var8) { - FMLLog.log(Level.ERROR, var8, "Could not save the splash.properties file", new Object[0]); - var4 = false; + FMLLog.log(Level.ERROR, var8, "Could not save the splash.properties file"); + } finally { IOUtils.closeQuietly(w); } - return var4; + return false; } private static IResourcePack createResourcePack(File file) { - return (IResourcePack)(file.isDirectory() ? new FolderResourcePack(file) : new FileResourcePack(file)); - } - - public static void drawVanillaScreen(TextureManager renderEngine) throws LWJGLException { - if (!enabled) { - Minecraft.getMinecraft().drawSplashScreen(renderEngine); - } - - } - - public static void clearVanillaResources(TextureManager renderEngine, ResourceLocation mojangLogo) { - if (!enabled) { - renderEngine.deleteTexture(mojangLogo); - } - + return file.isDirectory() ? new FolderResourcePack(file) : new FileResourcePack(file); } public static void checkGLError(String where) { @@ -549,7 +415,7 @@ private static InputStream open(ResourceLocation loc) throws IOException { private static class SplashFontRenderer extends FontRenderer { public SplashFontRenderer() { - super(Minecraft.getMinecraft().gameSettings, CustomSplashProgress.fontTexture.getLocation(), null, false); + super(Minecraft.getMinecraft().gameSettings, CustomSplashProgress.fontTexture.location, null, false); super.onResourceManagerReload(null); } @@ -567,11 +433,11 @@ protected InputStream getResourceInputStream(ResourceLocation location) throws I } private static class Texture { + private final ResourceLocation location; private final int name; private final int width; private final int height; - private final int frames; private final int size; public Texture(ResourceLocation location) { @@ -587,11 +453,11 @@ public Texture(ResourceLocation location) { } else { ImageReader reader = readers.next(); reader.setInput(stream); - this.frames = reader.getNumImages(true); - BufferedImage[] images = new BufferedImage[this.frames]; + int frames = reader.getNumImages(true); + BufferedImage[] images = new BufferedImage[frames]; int size; - for(size = 0; size < this.frames; ++size) { + for(size = 0; size < frames; ++size) { images[size] = reader.read(size); } @@ -599,12 +465,11 @@ public Texture(ResourceLocation location) { size = 1; this.width = images[0].getWidth(); - for(this.height = images[0].getHeight(); size / this.width * (size / this.height) < this.frames; size *= 2) { + for(this.height = images[0].getHeight(); size / this.width * (size / this.height) < frames; size *= 2) { } this.size = size; GL11.glEnable(3553); - Class var8 = CustomSplashProgress.class; synchronized(CustomSplashProgress.class) { this.name = GL11.glGenTextures(); GL11.glBindTexture(3553, this.name); @@ -615,8 +480,8 @@ public Texture(ResourceLocation location) { GL11.glTexImage2D(3553, 0, 6408, size, size, 0, 32993, 33639, (IntBuffer)null); CustomSplashProgress.checkGLError("Texture creation"); - for(int i = 0; i * (size / this.width) < this.frames; ++i) { - for(int j = 0; i * (size / this.width) + j < this.frames && j < size / this.width; ++j) { + for(int i = 0; i * (size / this.width) < frames; ++i) { + for(int j = 0; i * (size / this.width) + j < frames && j < size / this.width; ++j) { CustomSplashProgress.buf.clear(); BufferedImage image = images[i * (size / this.width) + j]; @@ -643,30 +508,6 @@ public Texture(ResourceLocation location) { } } - public ResourceLocation getLocation() { - return this.location; - } - - public int getName() { - return this.name; - } - - public int getWidth() { - return this.width; - } - - public int getHeight() { - return this.height; - } - - public int getFrames() { - return this.frames; - } - - public int getSize() { - return this.size; - } - public void bind() { GL11.glBindTexture(3553, this.name); } diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/MainMenuButton.java b/src/main/java/net/ccbluex/liquidbounce/utils/MainMenuButton.java index 2fbd068bd3..baa5a7d7f6 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/MainMenuButton.java +++ b/src/main/java/net/ccbluex/liquidbounce/utils/MainMenuButton.java @@ -5,7 +5,8 @@ */ package net.ccbluex.liquidbounce.utils; -import net.ccbluex.liquidbounce.ui.clickgui.fonts.impl.Fonts; + +import net.ccbluex.liquidbounce.ui.font.Fonts; import net.ccbluex.liquidbounce.utils.render.RenderUtils; import java.awt.*; @@ -34,9 +35,9 @@ public void draw(float x, float y, int mouseX, int mouseY) { this.y = y; RenderUtils.drawRoundedCornerRect(x-30F,y-30F,x+30f,y+30f,15f,new Color(0,0,0,40).getRGB()); this.yAnimation = RenderUtils.smoothAnimation(this.yAnimation, RenderUtils.isHovering(mouseX, mouseY, this.x-30f, this.y-30f, this.x + 30.0F, this.y + 30.0F) ? 4.0F : 0.0F, 20.0F, 0.3F); - Fonts.MAINMENU.MAINMENU30.MAINMENU30.drawString(this.icon, x - (float) Fonts.MAINMENU.MAINMENU30.MAINMENU30.stringWidth(this.icon) / 2.0F, y-6f+(this.yAnimation*-1f), Color.WHITE.getRGB(),false); + Fonts.fontMainMenu60.drawString(this.icon, x - (float) Fonts.fontMainMenu60.getStringWidth(this.icon) / 2.0F, y-6f+(this.yAnimation*-1f), Color.WHITE.getRGB(),false); if(this.yAnimation>=0.11) { - Fonts.SF.SF_16.SF_16.drawString(this.text, x - (float) Fonts.SF.SF_16.SF_16.stringWidth(this.text) / 2.0F, y + 12f +(this.yAnimation*-1f), new Color(255,255,255, ((((this.yAnimation/4.0f)) * 254.0f * 1f)<=255.0f) ? (int)(((this.yAnimation/4.0f)) * 254.0f + 1f) : 25).getRGB()); + Fonts.fontSFUI35.drawString(this.text, x - (float) Fonts.fontSFUI35.getStringWidth(this.text) / 2.0F, y + 12f +(this.yAnimation*-1f), new Color(255,255,255, ((((this.yAnimation/4.0f)) * 254.0f * 1f)<=255.0f) ? (int)(((this.yAnimation/4.0f)) * 254.0f + 1f) : 25).getRGB()); }//RenderUtils.drawGradientRect(x, y + 40.0F - this.yAnimation * 3.0F, x + 50.0F, y + 40.0F, 3453695, 2016719615); RenderUtils.drawRoundedCornerRect(x-30F,y-30F,x+30f,y+30f,15f,new Color(255,255,255,50).getRGB()); } diff --git a/src/main/java/net/ccbluex/liquidbounce/utils/render/ColorUtils.kt b/src/main/java/net/ccbluex/liquidbounce/utils/render/ColorUtils.kt index 2a3b482964..b8c768de65 100644 --- a/src/main/java/net/ccbluex/liquidbounce/utils/render/ColorUtils.kt +++ b/src/main/java/net/ccbluex/liquidbounce/utils/render/ColorUtils.kt @@ -130,7 +130,7 @@ object ColorUtils { } } - fun blend(color1: Color, color2: Color, ratio: Double): Color? { + private fun blend(color1: Color, color2: Color, ratio: Double): Color? { val r = ratio.toFloat() val ir = 1.0f - r val rgb1 = FloatArray(3) @@ -181,7 +181,7 @@ object ColorUtils { throw IllegalArgumentException("Fractions and colours must have equal number of elements") } - fun getFraction(fractions: FloatArray, progress: Float): IntArray { + private fun getFraction(fractions: FloatArray, progress: Float): IntArray { var startPoint: Int val range = IntArray(2) startPoint = 0 @@ -215,16 +215,16 @@ object ColorUtils { return Color.getHSBColor((abs(((((System.currentTimeMillis() - startTime).toInt() + index * indexOffset) / timeSplit.toFloat()) % 2) - 1) * (bigest - lowest)) + lowest, saturation, brightness) } - fun interpolate(oldValue: Double, newValue: Double, interpolationValue: Double): Double? { + fun interpolate(oldValue: Double, newValue: Double, interpolationValue: Double): Double { return oldValue + (newValue - oldValue) * interpolationValue } - fun interpolateFloat(oldValue: Float, newValue: Float, interpolationValue: Double): Float { - return net.ccbluex.liquidbounce.utils.render.ColorUtils.interpolate(oldValue.toDouble(), newValue.toDouble(), interpolationValue.toFloat().toDouble())!!.toFloat() + private fun interpolateFloat(oldValue: Float, newValue: Float, interpolationValue: Double): Float { + return interpolate(oldValue.toDouble(), newValue.toDouble(), interpolationValue.toFloat().toDouble()).toFloat() } - fun interpolateColorHue(color1: Color, color2: Color, amount: Float): Color? { + private fun interpolateColorHue(color1: Color, color2: Color, amount: Float): Color { var amount = amount - amount = Math.min(1f, Math.max(0f, amount)) + amount = 1f.coerceAtMost(0f.coerceAtLeast(amount)) val color1HSB = Color.RGBtoHSB(color1.red, color1.green, color1.blue, null) val color2HSB = Color.RGBtoHSB(color2.red, color2.green, color2.blue, null) val resultColor = Color.getHSBColor(interpolateFloat(color1HSB[0], color2HSB[0], amount.toDouble()), interpolateFloat(color1HSB[1], color2HSB[1], amount.toDouble()), interpolateFloat(color1HSB[2], color2HSB[2], amount.toDouble())) @@ -233,7 +233,6 @@ object ColorUtils { } - @JvmStatic fun astolfoRainbow(delay: Int, offset: Int, index: Int): Color { var rainbowDelay = ceil((System.currentTimeMillis() + (delay * index).toLong()).toDouble()) / offset @@ -243,13 +242,13 @@ object ColorUtils { @JvmStatic fun interpolateInt(oldValue: Int, newValue: Int, interpolationValue: Double): Int { - return interpolate(oldValue.toDouble(), newValue.toDouble(), interpolationValue.toFloat().toDouble())!!.toInt() + return interpolate(oldValue.toDouble(), newValue.toDouble(), interpolationValue.toFloat().toDouble()).toInt() } @JvmStatic - fun interpolateColorC(color1: Color, color2: Color, amount: Float): Color? { + fun interpolateColorC(color1: Color, color2: Color, amount: Float): Color { var amount = amount - amount = Math.min(1f, Math.max(0f, amount)) + amount = 1f.coerceAtMost(0f.coerceAtLeast(amount)) return Color( interpolateInt(color1.red, color2.red, amount.toDouble()), interpolateInt(color1.green, color2.green, amount.toDouble()), @@ -270,7 +269,7 @@ object ColorUtils { } @JvmStatic - fun getGradientOffset(color1: Color, color2: Color, offset: Double): Color? { + fun getGradientOffset(color1: Color, color2: Color, offset: Double): Color { var offset = offset if (offset > 1) { val left = offset % 1 @@ -285,11 +284,11 @@ object ColorUtils { } @JvmStatic - fun rainbowc(speed: Int, index: Int, saturation: Float, brightness: Float, opacity: Float): Color? { + fun rainbowc(speed: Int, index: Int, saturation: Float, brightness: Float, opacity: Float): Color { val angle = ((System.currentTimeMillis() / speed + index) % 360).toInt() val hue = angle / 360f val color = Color(Color.HSBtoRGB(hue, saturation, brightness)) - return Color(color.red, color.green, color.blue, Math.max(0, Math.min(255, (opacity * 255).toInt()))) + return Color(color.red, color.green, color.blue, 0.coerceAtLeast(min(255, (opacity * 255).toInt()))) } @JvmStatic fun rainbow(): Color { @@ -343,19 +342,14 @@ object ColorUtils { @JvmStatic fun StaticRainbow(speed: Int, index: Int): Color { - var angle = ((System.currentTimeMillis() / speed + index) % 360).toInt() + val angle = ((System.currentTimeMillis() / speed + index) % 360).toInt() val hue = angle / 360f - return Color.getHSBColor(if ((360.0.also { (angle).toInt() } / 360.0).toFloat().toDouble() < 0.5) -(angle / 360.0).toFloat() else (angle / 360.0).toFloat(), 0.5f, 1.0f) - } - - @JvmStatic - fun getFontColor(target: Any): Color { - return Color(0xAEB5B9) + return Color.getHSBColor(if ((360.0.also { angle } / 360.0).toFloat().toDouble() < 0.5) -(angle / 360.0).toFloat() else (angle / 360.0).toFloat(), 0.5f, 1.0f) } @JvmStatic fun otherAstolfo(delay: Int, offset: Int, index: Int): Int { - var rainbowDelay = Math.ceil((System.currentTimeMillis() + (delay * index).toLong()).toDouble()) / offset + var rainbowDelay = ceil((System.currentTimeMillis() + (delay * index).toLong()).toDouble()) / offset return Color.getHSBColor(if ((360.0.also { rainbowDelay %= it } / 360.0).toFloat() .toDouble() < 0.5) -(rainbowDelay / 360.0).toFloat() else (rainbowDelay / 360.0).toFloat(), 0.5f, 1.0f).rgb } @@ -395,7 +389,7 @@ object ColorUtils { return Color(color1.red + ((color2.red - color1.red) * percent).toInt(), color1.green + ((color2.green - color1.green) * percent).toInt(), color1.blue + ((color2.blue - color1.blue) * percent).toInt(), color1.alpha + ((color2.alpha - color1.alpha) * percent).toInt()) } - fun toRGB(n: Int, n2: Int, n3: Int, n4: Int): Int { + private fun toRGB(n: Int, n2: Int, n3: Int, n4: Int): Int { return (n4 and 0xFF shl 24) or (n3 and 0xFF shl 16) or (n2 and 0xFF shl 8) or (n and 0xFF) } @@ -408,7 +402,7 @@ object ColorUtils { setColorAlpha(color) } - fun setColorAlpha(color: Int) { + private fun setColorAlpha(color: Int) { val alpha = (color shr 24 and 255) / 255f val red = (color shr 16 and 255) / 255f val green = (color shr 8 and 255) / 255f diff --git a/src/main/resources/assets/minecraft/fdpclient/font/Bangers.ttf b/src/main/resources/assets/minecraft/fdpclient/font/Bangers.ttf deleted file mode 100644 index 0bba49670e..0000000000 Binary files a/src/main/resources/assets/minecraft/fdpclient/font/Bangers.ttf and /dev/null differ diff --git a/src/main/resources/assets/minecraft/fdpclient/font/Roboto-Medium.ttf b/src/main/resources/assets/minecraft/fdpclient/font/Roboto-Medium.ttf new file mode 100644 index 0000000000..c0442ee29d Binary files /dev/null and b/src/main/resources/assets/minecraft/fdpclient/font/Roboto-Medium.ttf differ diff --git a/src/main/resources/assets/minecraft/fdpclient/font/SF.ttf b/src/main/resources/assets/minecraft/fdpclient/font/SF.ttf deleted file mode 100644 index e50d50baf3..0000000000 Binary files a/src/main/resources/assets/minecraft/fdpclient/font/SF.ttf and /dev/null differ diff --git a/src/main/resources/mixins.fdpclient.json b/src/main/resources/mixins.fdpclient.json index 4ab3eb1f75..568b08e2a6 100644 --- a/src/main/resources/mixins.fdpclient.json +++ b/src/main/resources/mixins.fdpclient.json @@ -102,8 +102,6 @@ "render.MixinTileEntityRendererDispatcher", "render.MixinTileEntitySkullRenderer", "render.MixinVisGraph", - "resources.MixinDefaultResourcePack", - "resources.MixinSkinManager", "splash.MixinFMLClientHandler" ], "client": [