From 9081f4c3e86ec45c3c0a8aab27eff22ed55d418a Mon Sep 17 00:00:00 2001 From: Death Fuel <108496936+DeathFuel@users.noreply.github.com> Date: Tue, 29 Sep 2026 23:58:53 +0200 Subject: [PATCH] Various font improvements and fixes (#2165) --- .../client/font/BatchingFontRenderer.java | 74 ++++++------ .../angelica/client/font/FontProvider.java | 4 +- .../client/font/FontProviderCustom.java | 114 +++++++++--------- .../angelica/client/font/FontProviderMC.java | 15 ++- .../client/font/FontProviderUnicode.java | 23 +++- .../angelica/client/font/FontStrategist.java | 30 ++--- .../angelica/client/gui/FontConfigScreen.java | 83 ++++++++----- .../angelica/config/FontConfig.java | 7 +- .../gtnewhorizons/angelica/mixins/Mixins.java | 1 - .../interfaces/FontRendererAccessor.java | 3 - .../mixins/interfaces/ResourceAccessor.java | 7 -- .../resources/assets/angelica/lang/en_US.lang | 3 + .../assets/angelica/shaders/fontFilter.fsh | 20 ++- .../fontrenderer/MixinFontRenderer.java | 6 - .../fontrenderer/MixinMCResourceAccessor.java | 19 --- 15 files changed, 211 insertions(+), 198 deletions(-) delete mode 100644 src/main/java/com/gtnewhorizons/angelica/mixins/interfaces/ResourceAccessor.java delete mode 100644 src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/fontrenderer/MixinMCResourceAccessor.java diff --git a/src/main/java/com/gtnewhorizons/angelica/client/font/BatchingFontRenderer.java b/src/main/java/com/gtnewhorizons/angelica/client/font/BatchingFontRenderer.java index 60bd92199..3ddcc8b2c 100644 --- a/src/main/java/com/gtnewhorizons/angelica/client/font/BatchingFontRenderer.java +++ b/src/main/java/com/gtnewhorizons/angelica/client/font/BatchingFontRenderer.java @@ -16,7 +16,6 @@ import com.gtnewhorizons.angelica.glsm.hooks.GLSMConfig; import com.gtnewhorizons.angelica.glsm.streaming.PersistentStreamingBuffer; import com.gtnewhorizons.angelica.glsm.streaming.StreamingUploader; import com.gtnewhorizons.angelica.hudcaching.HUDCaching; -import com.gtnewhorizons.angelica.mixins.interfaces.FontRendererAccessor; import com.gtnewhorizons.angelica.rendering.tesr.BatchDrawDefaults; import com.gtnewhorizons.angelica.rendering.tesr.ModelPartBatcher; import com.gtnewhorizons.angelica.rendering.tesr.TesrBatchRenderer; @@ -83,6 +82,7 @@ public class BatchingFontRenderer { private final int AAMode; private final int AAStrength; + private final int fontBrightness; private final int alphaTestRefLocation; private final int mvpMatrixLocation; private final int lightmapLocation; @@ -126,10 +126,10 @@ public class BatchingFontRenderer { FontProviderMC.get(this.isSGA).charWidth = this.charWidth; FontProviderMC.get(this.isSGA).locationFontTexture = this.locationFontTexture; - //noinspection deprecation fontShaderId = FontAAShader.getProgram().getProgramId(); AAMode = GLStateManager.glGetUniformLocation(fontShaderId, "aaMode"); AAStrength = GLStateManager.glGetUniformLocation(fontShaderId, "strength"); + fontBrightness = GLStateManager.glGetUniformLocation(fontShaderId, "fontBrightness"); alphaTestRefLocation = GLStateManager.glGetUniformLocation(fontShaderId, "alphaTestRef"); mvpMatrixLocation = GLStateManager.glGetUniformLocation(fontShaderId, "u_MVPMatrix"); lightmapLocation = GLStateManager.glGetUniformLocation(fontShaderId, "u_Lightmap"); @@ -144,8 +144,6 @@ public class BatchingFontRenderer { // === Batched rendering private static final int INITIAL_BATCH_SIZE = 2048; - private static final ResourceLocation DUMMY_RESOURCE_LOCATION = new ResourceLocation("angelica$dummy", - "this is invalid!"); // Layout in data: // [v, v, t, t, c, c, c, c, tb, tb, tb, tb] @@ -402,11 +400,11 @@ public class BatchingFontRenderer { private static final int LAYER_BACKGROUND = -1; private static final int LAYER_DEFAULT = 0; - private void pushDrawCmd(int startIdx, int idxCount, ResourceLocation texture, boolean isUnicode) { + private void pushDrawCmd(int startIdx, int idxCount, int texture, boolean isUnicode) { pushDrawCmd(startIdx, idxCount, texture, isUnicode, LAYER_DEFAULT); } - private void pushDrawCmd(int startIdx, int idxCount, ResourceLocation texture, boolean isUnicode, int layer) { + private void pushDrawCmd(int startIdx, int idxCount, int texture, boolean isUnicode, int layer) { arenaOwner = this; // Never coalesce into a command below the watermark - it belongs to a sealed segment. if (batchCommands.size() > batchSealedEnd) { @@ -433,7 +431,7 @@ public class BatchingFontRenderer { public int startVtx; public int idxCount; public boolean isUnicode; - public ResourceLocation texture; + public int texture; /** * Sorted ahead of the texture, so lower layers draw first. Sorting by texture * means submission order is not kept, so anything belonging under the glyphs @@ -441,11 +439,11 @@ public class BatchingFontRenderer { */ public int layer; - public void reset(int startVtx, int vtxCount, ResourceLocation texture, boolean isUnicode) { + public void reset(int startVtx, int vtxCount, int texture, boolean isUnicode) { reset(startVtx, vtxCount, texture, isUnicode, LAYER_DEFAULT); } - public void reset(int startVtx, int vtxCount, ResourceLocation texture, boolean isUnicode, int layer) { + public void reset(int startVtx, int vtxCount, int texture, boolean isUnicode, int layer) { this.layer = layer; this.startVtx = startVtx; this.idxCount = vtxCount; @@ -458,8 +456,7 @@ public class BatchingFontRenderer { if (obj == this) return true; if (obj == null || obj.getClass() != this.getClass()) return false; var that = (FontDrawCmd) obj; - return this.startVtx == that.startVtx && this.idxCount == that.idxCount && Objects.equals(this.texture, - that.texture); + return this.startVtx == that.startVtx && this.idxCount == that.idxCount && this.texture == that.texture; } @Override @@ -483,10 +480,8 @@ public class BatchingFontRenderer { public static final Comparator DRAW_ORDER_COMPARATOR = Comparator.comparingInt((FontDrawCmd fdc) -> fdc.layer) - .thenComparing(fdc -> fdc.texture, - Comparator.nullsLast(Comparator.comparing(ResourceLocation::getResourceDomain) - .thenComparing(ResourceLocation::getResourcePath))) - .thenComparing(fdc -> fdc.startVtx); + .thenComparingInt(fdc -> fdc.texture == 0 ? Integer.MAX_VALUE : fdc.texture) + .thenComparingInt(fdc -> fdc.startVtx); } /** @@ -599,7 +594,7 @@ public class BatchingFontRenderer { deferredIdxPos = 0; truncateBatchToWatermark(); arenaOwner = null; - flushLastTexture = null; + flushLastTexture = 0; } private void deferBatch() { @@ -704,7 +699,7 @@ public class BatchingFontRenderer { GLStateManager.glActiveTexture(GL13.GL_TEXTURE0); deferredSegments.get(0).owner.setupFontDrawState(); GLStateManager.glDepthMask(false); - flushLastTexture = DUMMY_RESOURCE_LOCATION; + flushLastTexture = -1; resetFlushLightmap(); try (MemoryStack stack = stackPush()) { final FloatBuffer mvpBuf = stack.mallocFloat(16); @@ -769,6 +764,7 @@ public class BatchingFontRenderer { private static final Matrix4f scratchModelView = new Matrix4f(); private int fontAAModeLast = -1; private int fontAAStrengthLast = -1; + private float fontBrightnessLast = -1; private void flushBatch() { final boolean locked = GLStateManager.acquireDrawLock(); @@ -827,7 +823,7 @@ public class BatchingFontRenderer { final int d = GLStateManager.pushState(StateSet.FONT); try { setupFontDrawState(); - flushLastTexture = DUMMY_RESOURCE_LOCATION; + flushLastTexture = -1; resetFlushLightmap(); try (MemoryStack stack = stackPush()) { final FloatBuffer mvpBuf = stack.mallocFloat(16); @@ -874,6 +870,10 @@ public class BatchingFontRenderer { fontAAStrengthLast = FontConfig.fontAAStrength; GLStateManager.glUniform1f(AAStrength, FontConfig.fontAAStrength / 120.f); } + if (FontConfig.fontBrightness != fontBrightnessLast) { + fontBrightnessLast = FontConfig.fontBrightness; + GLStateManager.glUniform1f(fontBrightness, 0.625f * FontConfig.fontBrightness + 0.1875f); + } GLStateManager.glUniform1f(alphaTestRefLocation, GLStateManager.getAlphaState().getReference()); if (lightmapSamplerProgram != fontShaderId) { GLStateManager.glUniform1i(lightmapSamplerLocation, LIGHTMAP_TEX_UNIT); @@ -913,7 +913,7 @@ public class BatchingFontRenderer { } } - private static ResourceLocation flushLastTexture; + private static int flushLastTexture; private static float flushLastLightmapU; private static float flushLastLightmapV; @@ -950,14 +950,14 @@ public class BatchingFontRenderer { private static void drawCommands(FontDrawCmd[] cmdsData, int from, int to, BatchingFontRenderer owner) { for (int i = from; i < to; i++) { final FontDrawCmd cmd = cmdsData[i]; - if (!Objects.equals(flushLastTexture, cmd.texture)) { - if (flushLastTexture == null) { + if (flushLastTexture != cmd.texture) { + if (flushLastTexture == 0) { GLStateManager.glEnable(GL11.GL_TEXTURE_2D); - } else if (cmd.texture == null) { + } else if (cmd.texture == 0) { GLStateManager.glDisable(GL11.GL_TEXTURE_2D); } - if (cmd.texture != null) { - ((FontRendererAccessor) owner.underlying).angelica$bindTexture(cmd.texture); + if (cmd.texture != 0) { + GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, cmd.texture); } flushLastTexture = cmd.texture; } @@ -1028,21 +1028,21 @@ public class BatchingFontRenderer { private static void emitRangeThroughPipeline(BatchingFontRenderer owner, FontDrawCmd[] cmdsData, int from, int to, int packedLight, float normalX, float normalY, float normalZ) { final Tessellator tessellator = Tessellator.instance; - ResourceLocation lastTexture = DUMMY_RESOURCE_LOCATION; + int lastTexture = -1; boolean drawing = false; try { for (int i = from; i < to; i++) { final FontDrawCmd cmd = cmdsData[i]; - if (!Objects.equals(lastTexture, cmd.texture)) { + if (lastTexture != cmd.texture) { if (drawing) { tessellator.draw(); drawing = false; } - if (cmd.texture == null) { + if (cmd.texture == 0) { GLStateManager.disableTexture(); } else { GLStateManager.enableTexture(); - ((FontRendererAccessor) owner.underlying).angelica$bindTexture(cmd.texture); + GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, cmd.texture); } lastTexture = cmd.texture; } @@ -1257,7 +1257,7 @@ public class BatchingFontRenderer { if (curUnderline && underlineStartX != underlineEndX) { final int ulIdx = idxWriterIndex; pushUntexRect(underlineStartX, underlineY, underlineEndX - underlineStartX, glyphScaleY, curColor); - pushDrawCmd(ulIdx, 6, null, false); + pushDrawCmd(ulIdx, 6, 0, false); underlineStartX = underlineEndX; } if (curStrikethrough && strikethroughStartX != strikethroughEndX) { @@ -1268,7 +1268,7 @@ public class BatchingFontRenderer { strikethroughEndX - strikethroughStartX, glyphScaleY, curColor); - pushDrawCmd(ulIdx, 6, null, false); + pushDrawCmd(ulIdx, 6, 0, false); strikethroughStartX = strikethroughEndX; } @@ -1442,11 +1442,11 @@ public class BatchingFontRenderer { final float glyphW = fontProvider.getGlyphW(chr) * glyphScaleX; final float uSz = fontProvider.getUSize(chr); final float vSz = fontProvider.getVSize(chr); - final float itOff = curItalic ? 1.0F : 0.0F; // italic offset + final float itOff = curItalic ? glyphScaleX : 0.0F; // italic offset final float shadowOffset = fontProvider.getShadowOffset(); final int shadowCopies = FontConfig.shadowCopies; final int boldCopies = FontConfig.boldCopies; - final ResourceLocation texture = fontProvider.getTexture(chr); + final int texture = fontProvider.getTexture(chr); // Wave: Y offset via sine wave float renderY = heightNorth; @@ -1477,7 +1477,7 @@ public class BatchingFontRenderer { if (glyphBackground != 0) { final int bgIdx = idxWriterIndex; pushUntexRect(renderX, renderY, glyphW, heightSouth, glyphBackground); - pushDrawCmd(bgIdx, 6, null, false, LAYER_BACKGROUND); + pushDrawCmd(bgIdx, 6, 0, false, LAYER_BACKGROUND); } // After the background, so this command covers only what is counted below. @@ -1531,13 +1531,13 @@ public class BatchingFontRenderer { if (perGlyphColor && curUnderline && underlineStartX != underlineEndX) { final int ulIdx = idxWriterIndex; pushUntexRect(underlineStartX, underlineY, underlineEndX - underlineStartX, glyphScaleY, glyphColor); - pushDrawCmd(ulIdx, 6, null, false); + pushDrawCmd(ulIdx, 6, 0, false); underlineStartX = underlineEndX; } if (perGlyphColor && curStrikethrough && strikethroughStartX != strikethroughEndX) { final int stIdx = idxWriterIndex; pushUntexRect(strikethroughStartX, strikethroughY, strikethroughEndX - strikethroughStartX, glyphScaleY, glyphColor); - pushDrawCmd(stIdx, 6, null, false); + pushDrawCmd(stIdx, 6, 0, false); strikethroughStartX = strikethroughEndX; } } @@ -1545,7 +1545,7 @@ public class BatchingFontRenderer { if (curUnderline && underlineStartX != underlineEndX) { final int ulIdx = idxWriterIndex; pushUntexRect(underlineStartX, underlineY, underlineEndX - underlineStartX, glyphScaleY, curColor); - pushDrawCmd(ulIdx, 6, null, false); + pushDrawCmd(ulIdx, 6, 0, false); } if (curStrikethrough && strikethroughStartX != strikethroughEndX) { final int ulIdx = idxWriterIndex; @@ -1555,7 +1555,7 @@ public class BatchingFontRenderer { strikethroughEndX - strikethroughStartX, glyphScaleY, curColor); - pushDrawCmd(ulIdx, 6, null, false); + pushDrawCmd(ulIdx, 6, 0, false); } } finally { diff --git a/src/main/java/com/gtnewhorizons/angelica/client/font/FontProvider.java b/src/main/java/com/gtnewhorizons/angelica/client/font/FontProvider.java index cc9cbf94a..16a9caf33 100644 --- a/src/main/java/com/gtnewhorizons/angelica/client/font/FontProvider.java +++ b/src/main/java/com/gtnewhorizons/angelica/client/font/FontProvider.java @@ -1,7 +1,5 @@ package com.gtnewhorizons.angelica.client.font; -import net.minecraft.util.ResourceLocation; - public interface FontProvider { /** Tries before {@link #getRandomReplacement} gives up and leaves the character alone. */ @@ -20,6 +18,6 @@ public interface FontProvider { float getUSize(char chr); float getVSize(char chr); float getShadowOffset(); - ResourceLocation getTexture(char chr); + int getTexture(char chr); float getYScaleMultiplier(); } diff --git a/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderCustom.java b/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderCustom.java index 9797a5cc5..20de088a2 100644 --- a/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderCustom.java +++ b/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderCustom.java @@ -1,34 +1,36 @@ package com.gtnewhorizons.angelica.client.font; +import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities.memAddress0; +import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities.memAllocInt; +import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities.memFree; +import static com.gtnewhorizon.gtnhlib.bytebuf.MemoryUtilities.memPutInt; + import com.gtnewhorizons.angelica.config.FontConfig; +import com.gtnewhorizons.angelica.glsm.GLStateManager; import jss.util.RandomXoshiro256StarStar; import lombok.Setter; import lombok.Value; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.texture.ITextureObject; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.renderer.texture.TextureUtil; -import net.minecraft.util.ResourceLocation; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; -import javax.imageio.ImageIO; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Map; +import java.awt.image.ColorModel; +import java.awt.image.DataBufferInt; +import java.awt.image.Raster; +import java.nio.IntBuffer; import java.util.Objects; +import static com.gtnewhorizons.angelica.client.font.FontStrategist.getFontName; + public final class FontProviderCustom implements FontProvider { public static final Logger LOGGER = LogManager.getLogger("Angelica"); - public static final String FONT_DIR = "fonts/custom/"; static final int ATLAS_SIZE = 128; static final int ATLAS_COUNT = 512; private final byte id; // 0 - primary font, 1 - fallback font @@ -52,7 +54,7 @@ public final class FontProviderCustom implements FontProvider { } int fontPos = -1; for (int i = 0; i < availableFonts.length; i++) { - if (Objects.equals(myFontName, availableFonts[i].getFontName())) { + if (Objects.equals(myFontName, getFontName(availableFonts[i]))) { fontPos = i; break; } @@ -75,45 +77,15 @@ public final class FontProviderCustom implements FontProvider { this.currentFontQuality = FontConfig.customFontQuality; this.font = FontStrategist.getAvailableFonts()[fontID].deriveFont(this.currentFontQuality); - File[] files = new File(getFontDir()).listFiles(); - if (files != null) { - for (File f : files) { - if (!Files.isSymbolicLink(f.toPath())) { - f.delete(); - } - } - } - - TextureManager tm = Minecraft.getMinecraft().getTextureManager(); - Map mapTextureObjects = tm.mapTextureObjects; - for (int i = 0; i < ATLAS_COUNT; i++) { - ResourceLocation key = new ResourceLocation(getAtlasResourceName(i)); - if (mapTextureObjects.containsKey(key)) { - ITextureObject obj = (ITextureObject) mapTextureObjects.get(key); - TextureUtil.deleteTexture(obj.getGlTextureId()); - mapTextureObjects.remove(key); + for (FontAtlas atlas : fontAtlases) { + if (atlas != null && atlas.texture != 0) { + GLStateManager.glDeleteTextures(atlas.texture); } } this.fontAtlases = new FontAtlas[ATLAS_COUNT]; } - private String getFontDir() { - return FONT_DIR + "f" + this.id + "/"; - } - - private String getAtlasFilename(int atlasId) { - return "f" + this.id + "p" + atlasId; - } - - String getAtlasResourceName(int atlasId) { - return "minecraft:angelica_c" + getAtlasFilename(atlasId); - } - - String getAtlasFullPath(int atlasId) { - return getFontDir() + getAtlasFilename(atlasId) + ".png"; - } - @Value private class GlyphData { float uStart; @@ -125,9 +97,8 @@ public final class FontProviderCustom implements FontProvider { } private class FontAtlas { - GlyphData[] glyphData = new GlyphData[ATLAS_SIZE]; - private ResourceLocation texture; + private int texture; private final int id; FontAtlas(int id) { @@ -214,13 +185,46 @@ public final class FontProviderCustom implements FontProvider { tileX++; } g2d.dispose(); - try { - Files.createDirectories(Paths.get(getFontDir())); - ImageIO.write(image, "png", new File(getAtlasFullPath(this.id))); - } catch (IOException e) { - e.printStackTrace(); + + int id = GLStateManager.glGenTextures(); + GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, id); + GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST); + GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); + GLStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); + + final int width = image.getWidth(); + final int height = image.getHeight(); + final IntBuffer pixelBuffer = memAllocInt(width * height); + long ptr = memAddress0(pixelBuffer); + + if (image.getRaster().getDataBuffer() instanceof DataBufferInt dataBufferInt) { + final int[] pixelValues = dataBufferInt.getData(); + + for (int i : pixelValues) { + memPutInt(ptr, i); + ptr += 4; + } + + pixelBuffer.limit(pixelValues.length); + } else { + Raster raster = image.getRaster(); + ColorModel colorModel = image.getColorModel(); + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + Object pixel = raster.getDataElements(x, y, null); + memPutInt(ptr, colorModel.getRGB(pixel)); + ptr += 4; + } + } + pixelBuffer.limit(image.getHeight() * image.getWidth()); } - this.texture = new ResourceLocation(getAtlasResourceName(this.id)); + + GLStateManager.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL12.GL_BGRA, image.getWidth(), image.getHeight(), 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, pixelBuffer); + memFree(pixelBuffer); + + this.texture = id; } } @@ -303,7 +307,7 @@ public final class FontProviderCustom implements FontProvider { } @Override - public ResourceLocation getTexture(char chr) { + public int getTexture(char chr) { return getAtlas(chr).texture; } diff --git a/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderMC.java b/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderMC.java index 0ddf707a9..e108875d7 100644 --- a/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderMC.java +++ b/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderMC.java @@ -3,6 +3,10 @@ package com.gtnewhorizons.angelica.client.font; import com.gtnewhorizons.angelica.config.FontConfig; import it.unimi.dsi.fastutil.chars.Char2ShortOpenHashMap; import jss.util.RandomXoshiro256StarStar; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.SimpleTexture; +import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.util.ResourceLocation; public final class FontProviderMC implements FontProvider { @@ -109,8 +113,15 @@ public final class FontProviderMC implements FontProvider { } @Override - public ResourceLocation getTexture(char chr) { - return locationFontTexture; + public int getTexture(char chr) { + final TextureManager tm = Minecraft.getMinecraft().getTextureManager(); + ITextureObject tex = tm.getTexture(locationFontTexture); + if (tex == null) { + tex = new SimpleTexture(locationFontTexture); + tm.loadTexture(locationFontTexture, tex); + tex = tm.getTexture(locationFontTexture); + } + return tex.getGlTextureId(); } @Override diff --git a/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderUnicode.java b/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderUnicode.java index 44de74ff1..c976535c6 100644 --- a/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderUnicode.java +++ b/src/main/java/com/gtnewhorizons/angelica/client/font/FontProviderUnicode.java @@ -3,6 +3,9 @@ package com.gtnewhorizons.angelica.client.font; import com.gtnewhorizons.angelica.config.FontConfig; import jss.util.RandomXoshiro256StarStar; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.client.renderer.texture.SimpleTexture; +import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.IResourceManagerReloadListener; @@ -79,12 +82,12 @@ public final class FontProviderUnicode implements FontProvider, IResourceManager @Override public float getUStart(char chr) { final float startColumnF = (float)((this.glyphWidth[chr] >>> 4) & 15); - return ((float) (chr % 16 * 16) + startColumnF + 0.21f) / 256.0f; + return ((float) (chr % 16 * 16) + startColumnF + 0.01f) / 256.0f; } @Override public float getVStart(char chr) { - return ((float) ((chr & 255) / 16 * 16) + 0.21f) / 256.0f; + return ((float) ((chr & 255) / 16 * 16) + 0.01f) / 256.0f; } @Override @@ -113,12 +116,12 @@ public final class FontProviderUnicode implements FontProvider, IResourceManager final float startColumnF = (float) startColumn; final float endColumnF = (float) (endColumn + 1); final float chrWidth = endColumnF - startColumnF - 0.02F; - return (chrWidth - 0.42f) / 256.0f; + return (chrWidth - 0.02f) / 256.0f; } @Override public float getVSize(char chr) { - return (16.0f - 0.42f) / 256.0f; + return (16.0f - 0.02f) / 256.0f; } @Override @@ -127,9 +130,17 @@ public final class FontProviderUnicode implements FontProvider, IResourceManager } @Override - public ResourceLocation getTexture(char chr) { + public int getTexture(char chr) { final int uniPage = chr / 256; - return getUnicodePageLocation(uniPage); + ResourceLocation rl = getUnicodePageLocation(uniPage); + final TextureManager tm = Minecraft.getMinecraft().getTextureManager(); + ITextureObject tex = tm.getTexture(rl); + if (tex == null) { + tex = new SimpleTexture(rl); + tm.loadTexture(rl, tex); + tex = tm.getTexture(rl); + } + return tex.getGlTextureId(); } @Override diff --git a/src/main/java/com/gtnewhorizons/angelica/client/font/FontStrategist.java b/src/main/java/com/gtnewhorizons/angelica/client/font/FontStrategist.java index 183d4a593..03976d297 100644 --- a/src/main/java/com/gtnewhorizons/angelica/client/font/FontStrategist.java +++ b/src/main/java/com/gtnewhorizons/angelica/client/font/FontStrategist.java @@ -2,14 +2,11 @@ package com.gtnewhorizons.angelica.client.font; import com.google.common.collect.HashMultiset; import com.gtnewhorizons.angelica.config.FontConfig; -import com.gtnewhorizons.angelica.mixins.interfaces.ResourceAccessor; import cpw.mods.fml.client.SplashProgress; import cpw.mods.fml.common.versioning.DefaultArtifactVersion; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.resources.DefaultResourcePack; -import net.minecraft.client.resources.SimpleReloadableResourceManager; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -25,12 +22,15 @@ import java.nio.charset.StandardCharsets; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; public class FontStrategist { @Getter private static final Font[] availableFonts; + private static final Map fontNameMap; public static final Logger LOGGER = LogManager.getLogger("Angelica"); private static final boolean isSafeToUseAwtEnvironmentData = checkIsSafeToUseAwtEnvironmentData(); @@ -74,20 +74,13 @@ public class FontStrategist { loadBundledFonts(fontSet); - availableFonts = fontSet.values().stream().sorted(Comparator.comparing(Font::getFontName)).toArray(Font[]::new); + fontNameMap = fontSet.entrySet().stream().collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey)); + availableFonts = fontSet.values().stream().sorted(Comparator.comparing(fontNameMap::get)).toArray(Font[]::new); + } - // create and add the resource pack that provides fonts - HashMap packMap = new HashMap<>(); - for (int i = 0; i < FontProviderCustom.ATLAS_COUNT; i++) { - packMap.put(FontProviderCustom.getPrimary().getAtlasResourceName(i), new File(FontProviderCustom.getPrimary().getAtlasFullPath(i))); - packMap.put(FontProviderCustom.getFallback().getAtlasResourceName(i), new File(FontProviderCustom.getFallback().getAtlasFullPath(i))); - } - - Minecraft mc = Minecraft.getMinecraft(); - DefaultResourcePack fontResourcePack = new DefaultResourcePack(packMap); - - ((ResourceAccessor) mc).angelica$getDefaultResourcePacks().add(fontResourcePack); - ((SimpleReloadableResourceManager) mc.getResourceManager()).reloadResourcePack(fontResourcePack); + // reduces allocations + public static String getFontName(Font font) { + return fontNameMap.get(font); } private static boolean checkIsSafeToUseAwtEnvironmentData() { @@ -181,10 +174,11 @@ public class FontStrategist { FontProviderCustom.getPrimary().setFont(null); FontProviderCustom.getFallback().setFont(null); for (int i = 0; i < availableFonts.length; i++) { - if (Objects.equals(FontConfig.customFontNamePrimary, availableFonts[i].getFontName())) { + String fontName = getFontName(availableFonts[i]); + if (Objects.equals(FontConfig.customFontNamePrimary, fontName)) { FontProviderCustom.getPrimary().reloadFont(i); } - if (Objects.equals(FontConfig.customFontNameFallback, availableFonts[i].getFontName())) { + if (Objects.equals(FontConfig.customFontNameFallback, fontName)) { FontProviderCustom.getFallback().reloadFont(i); } } diff --git a/src/main/java/com/gtnewhorizons/angelica/client/gui/FontConfigScreen.java b/src/main/java/com/gtnewhorizons/angelica/client/gui/FontConfigScreen.java index 4cfdf46eb..b0a503c21 100644 --- a/src/main/java/com/gtnewhorizons/angelica/client/gui/FontConfigScreen.java +++ b/src/main/java/com/gtnewhorizons/angelica/client/gui/FontConfigScreen.java @@ -21,6 +21,8 @@ import java.util.List; import java.util.Objects; import java.util.stream.Collectors; +import static com.gtnewhorizons.angelica.client.font.FontStrategist.getFontName; + public class FontConfigScreen extends GuiScreen { private static final Font[] availableFonts = FontStrategist.getAvailableFonts(); @@ -52,11 +54,12 @@ public class FontConfigScreen extends GuiScreen { SliderClone.Option optShadowCopies = new SliderClone.Option(1, 8, 1); SliderClone.Option optBoldCopies = new SliderClone.Option(1, 8, 1); SliderClone.Option optGlyphAspect = new SliderClone.Option(-1, 1, 0.05f); - SliderClone.Option optGlyphScale = new SliderClone.Option(0.1f, 3, 0.05f); + SliderClone.Option optGlyphScale = new SliderClone.Option(0.25f, 2, 0.01f); SliderClone.Option optWhitespaceScale = new SliderClone.Option(0.1f, 3, 0.05f); SliderClone.Option optGlyphSpacing = new SliderClone.Option(-2f, 2f, 0.05f); SliderClone.Option optFontAAMode = new SliderClone.Option(0, 2, 1); SliderClone.Option optFontAAStrength = new SliderClone.Option(1, 24, 1); + SliderClone.Option optFontBrightness = new SliderClone.Option(0, 1, 0.05f); SliderClone.Option optCustomFontScale = new SliderClone.Option(0.1f, 3, 0.05f); SliderClone.Option optShadowOffsetUC = new SliderClone.Option(0, 2, 0.05f); @@ -69,10 +72,11 @@ public class FontConfigScreen extends GuiScreen { this.currentFallbackFontName = FontConfig.customFontNameFallback; this.displayedFonts = new ArrayList<>(Arrays.asList(availableFonts)); for (int i = 0; i < availableFonts.length; i++) { - if (Objects.equals(this.currentPrimaryFontName, availableFonts[i].getFontName())) { + String fontName = getFontName(availableFonts[i]); + if (Objects.equals(this.currentPrimaryFontName, fontName)) { selectedPrimaryFontListPos = i; } - if (Objects.equals(this.currentFallbackFontName, availableFonts[i].getFontName())) { + if (Objects.equals(this.currentFallbackFontName, fontName)) { selectedFallbackFontListPos = i; } } @@ -217,6 +221,16 @@ public class FontConfigScreen extends GuiScreen { .formatString("%.0f") .build() ); + sliders.add(new SliderClone.SliderCloneBuilder() + .width(sliderWidth) + .height(sliderHeight) + .option(optFontBrightness) + .initialValue(FontConfig.fontBrightness) + .setter(value -> FontConfig.fontBrightness = value) + .langKey("options.angelica.fontconfig.font_brightness") + .formatString("%3.2f") + .build() + ); sliders.add(new SliderClone.SliderCloneBuilder() .width(sliderWidth) .height(sliderHeight) @@ -278,11 +292,11 @@ public class FontConfigScreen extends GuiScreen { int pos; pos = selectedPrimaryFontListPos; if (pos >= 0 && pos < displayedFonts.size()) { - FontConfig.customFontNamePrimary = displayedFonts.get(pos).getFontName(); + FontConfig.customFontNamePrimary = getFontName(displayedFonts.get(pos)); } pos = selectedFallbackFontListPos; if (pos >= 0 && pos < displayedFonts.size()) { - FontConfig.customFontNameFallback = displayedFonts.get(pos).getFontName(); + FontConfig.customFontNameFallback = getFontName(displayedFonts.get(pos)); } FontStrategist.reloadCustomFontProviders(); @@ -338,9 +352,9 @@ public class FontConfigScreen extends GuiScreen { }; } - private float lastMouseX = 0; - private float lastMouseY = 0; - private long lastStillTime = 0; + private int lastMouseX = 0; + private int lastMouseY = 0; + private long lastMovedTime = -1; @Override public void drawScreen(int mouseX, int mouseY, float delta) { drawBackground(0); @@ -366,8 +380,9 @@ public class FontConfigScreen extends GuiScreen { this.searchBox.yPosition + this.searchBox.height / 2 - 4, 0xFFFFFF); } drawCenteredString(this.fontRendererObj, this.title, (int) (this.width * 0.5), 8, 0xFFFFFF); - drawCenteredString(this.fontRendererObj, I18n.format("options.angelica.fontconfig.currentfonts", - FontConfig.customFontNamePrimary, FontConfig.customFontNameFallback), (int) (this.width * 0.5), this.height - 92, 0xFFFFFF); + final int fontInfoTextY = 92; + String currentFonts = I18n.format("options.angelica.fontconfig.currentfonts", FontConfig.customFontNamePrimary, FontConfig.customFontNameFallback); + drawCenteredString(this.fontRendererObj, currentFonts, (int) (this.width * 0.5), this.height - fontInfoTextY, 0xFFFFFF); if (this.testAreaInfo == null) { this.testAreaInfo = this.fontRendererObj.listFormattedStringToWidth( @@ -398,6 +413,18 @@ public class FontConfigScreen extends GuiScreen { super.drawScreen(mouseX, mouseY, delta); + // tooltip code, can return + + long timeMillis = System.currentTimeMillis(); + + if (mouseX != lastMouseX || mouseY != lastMouseY) { + lastMovedTime = timeMillis; + lastMouseX = mouseX; + lastMouseY = mouseY; + } + + if (lastMovedTime + 500L > timeMillis) { return; } + for (GuiButton guiButton : buttonList) { if (!(guiButton instanceof SliderClone slider)) { continue; } final int top = slider.yPosition; @@ -405,20 +432,18 @@ public class FontConfigScreen extends GuiScreen { final int left = slider.xPosition; final int right = slider.xPosition + slider.width; if (mouseY < top || mouseY >= bot || mouseX < left || mouseX >= right) { continue; } - if (mouseX == lastMouseX && mouseY == lastMouseY) { - if (lastStillTime == 0) { - lastStillTime = System.currentTimeMillis(); - } - if (lastStillTime + 500L < System.currentTimeMillis()) { - displayTooltip(mouseX, mouseY, slider.tooltipKey); - } - } else { - lastStillTime = 0; - } - break; + displayTooltip(mouseX, mouseY, slider.tooltipKey); + return; + } + + int fontInfoTextWidth = this.fontRendererObj.getStringWidth(currentFonts); + int top = this.height - fontInfoTextY - 8; + int bot = this.height - fontInfoTextY + 16; + int left = this.width / 2 - fontInfoTextWidth / 2 - 8; + int right = this.width / 2 + fontInfoTextWidth / 2 + 8; + if (top <= mouseY && mouseY < bot && left <= mouseX && mouseX < right) { + displayTooltip(mouseX, mouseY, "options.angelica.fontconfig.font_selection_info"); } - lastMouseX = mouseX; - lastMouseY = mouseY; } private void displayTooltip(int x, int y, String langKey) { @@ -477,16 +502,16 @@ public class FontConfigScreen extends GuiScreen { if (search == null || search.isEmpty()) { results = new ArrayList<>(Arrays.asList(availableFonts)); } else { - results = Arrays.stream(availableFonts).filter((font -> font.getFontName().toLowerCase().contains(search))).collect(Collectors.toCollection(ArrayList::new)); + results = Arrays.stream(availableFonts).filter((font -> getFontName(font).toLowerCase().contains(search))).collect(Collectors.toCollection(ArrayList::new)); } selectedPrimaryFontListPos = -1; selectedFallbackFontListPos = -1; for (int i = 0; i < results.size(); i++) { - if (Objects.equals(currentPrimaryFontName, results.get(i).getFontName())) { + if (Objects.equals(currentPrimaryFontName, getFontName(results.get(i)))) { selectedPrimaryFontListPos = i; } - if (Objects.equals(currentFallbackFontName, results.get(i).getFontName())) { + if (Objects.equals(currentFallbackFontName, getFontName(results.get(i)))) { selectedFallbackFontListPos = i; } } @@ -520,10 +545,10 @@ public class FontConfigScreen extends GuiScreen { protected void onElemClicked(int index, boolean rightClick) { if (!rightClick) { selectedPrimaryFontListPos = index; - currentPrimaryFontName = displayedFonts.get(index).getFontName(); + currentPrimaryFontName = getFontName(displayedFonts.get(index)); } else { selectedFallbackFontListPos = index; - currentFallbackFontName = displayedFonts.get(index).getFontName(); + currentFallbackFontName = getFontName(displayedFonts.get(index)); } applyChanges(false); } @@ -566,7 +591,7 @@ public class FontConfigScreen extends GuiScreen { if (index == selectedFallbackFontListPos) { color &= 0x55ffff; } - drawCenteredString(fontRendererObj, displayedFonts.get(index).getFontName(), this.width / 2, y + 1, color); + drawCenteredString(fontRendererObj, getFontName(displayedFonts.get(index)), this.width / 2, y + 1, color); } } } diff --git a/src/main/java/com/gtnewhorizons/angelica/config/FontConfig.java b/src/main/java/com/gtnewhorizons/angelica/config/FontConfig.java index 3f0fb8db7..0fb55dc3b 100644 --- a/src/main/java/com/gtnewhorizons/angelica/config/FontConfig.java +++ b/src/main/java/com/gtnewhorizons/angelica/config/FontConfig.java @@ -64,10 +64,15 @@ public class FontConfig { public static int fontAAMode; @Config.Comment("Affects font antialiasing sample spacing. Higher values increase blur.") - @Config.DefaultInt(7) + @Config.DefaultInt(6) @Config.RangeInt(min = 1, max = 24) public static int fontAAStrength; + @Config.Comment("Affects the thickness of antialiased fonts. Can improve visibility of thin text.") + @Config.DefaultFloat(0.6f) + @Config.RangeFloat(min = 0, max = 1) + public static float fontBrightness; + @Config.Comment("Custom font scale multiplier, for bugfixes.") @Config.DefaultFloat(1.5F) @Config.RangeFloat(min = 0.1F, max = 3F) diff --git a/src/main/java/com/gtnewhorizons/angelica/mixins/Mixins.java b/src/main/java/com/gtnewhorizons/angelica/mixins/Mixins.java index 8907c2336..ff13c3d0e 100644 --- a/src/main/java/com/gtnewhorizons/angelica/mixins/Mixins.java +++ b/src/main/java/com/gtnewhorizons/angelica/mixins/Mixins.java @@ -150,7 +150,6 @@ public enum Mixins implements IMixins { .addClientMixins( "angelica.fontrenderer.MixinGuiIngameForge" , "angelica.fontrenderer.MixinFontRenderer" - , "angelica.fontrenderer.MixinMCResourceAccessor" ) ), diff --git a/src/main/java/com/gtnewhorizons/angelica/mixins/interfaces/FontRendererAccessor.java b/src/main/java/com/gtnewhorizons/angelica/mixins/interfaces/FontRendererAccessor.java index d01ce9940..3567e5a71 100644 --- a/src/main/java/com/gtnewhorizons/angelica/mixins/interfaces/FontRendererAccessor.java +++ b/src/main/java/com/gtnewhorizons/angelica/mixins/interfaces/FontRendererAccessor.java @@ -1,13 +1,10 @@ package com.gtnewhorizons.angelica.mixins.interfaces; import com.gtnewhorizons.angelica.client.font.BatchingFontRenderer; -import net.minecraft.util.ResourceLocation; public interface FontRendererAccessor { int angelica$drawStringBatched(String text, int x, int y, int argb, boolean dropShadow); BatchingFontRenderer angelica$getBatcher(); - - void angelica$bindTexture(ResourceLocation location); } diff --git a/src/main/java/com/gtnewhorizons/angelica/mixins/interfaces/ResourceAccessor.java b/src/main/java/com/gtnewhorizons/angelica/mixins/interfaces/ResourceAccessor.java deleted file mode 100644 index e439a3373..000000000 --- a/src/main/java/com/gtnewhorizons/angelica/mixins/interfaces/ResourceAccessor.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.gtnewhorizons.angelica.mixins.interfaces; - -import java.util.List; - -public interface ResourceAccessor { - List angelica$getDefaultResourcePacks(); -} diff --git a/src/main/resources/assets/angelica/lang/en_US.lang b/src/main/resources/assets/angelica/lang/en_US.lang index 890cb1f15..1ce9607b0 100644 --- a/src/main/resources/assets/angelica/lang/en_US.lang +++ b/src/main/resources/assets/angelica/lang/en_US.lang @@ -240,6 +240,7 @@ options.angelica.fontconfig.searchprompt=§7§oSearch fonts... options.angelica.fontconfig.testareaprompt=§7§oTest area... options.angelica.fontconfig.testareainfo=Enter text below to see how it renders. Use & for formatting. options.angelica.fontconfig.testareaexample=&d&lHerobrine&r was &7&m&oNOT&r &nhere +options.angelica.fontconfig.font_selection_info=Left-click on a list item to set the primary font. Right-click for the fallback font. Rendering priority: primary, fallback, Unicode font. options.angelica.fontconfig.disable_custom_font=Disable Custom Font options.angelica.fontconfig.enable_custom_font=Enable Custom Font options.angelica.fontconfig.reset_values=Reset Values @@ -256,6 +257,7 @@ options.angelica.fontconfig.font_aa_strength=Font AA Strength: %s options.angelica.fontconfig.aamode.aa_none=Font AA: OFF options.angelica.fontconfig.aamode.aa_4x=Font AA: 4x MSAA options.angelica.fontconfig.aamode.aa_16x=Font AA: 16x MSAA +options.angelica.fontconfig.font_brightness=Font Brightness: %s options.angelica.fontconfig.custom_font_scale=Custom Font Scale: %s options.angelica.fontconfig.shadow_offset_unicode=Unicode Shadow Offset: %s options.angelica.fontconfig.font_quality.tooltip=The quality at which custom fonts are rendered, making them less pixelated at the expense of some performance and memory. @@ -268,6 +270,7 @@ options.angelica.fontconfig.whitespace_scale.tooltip=The scaling factor of blank options.angelica.fontconfig.glyph_spacing.tooltip=The spacing between each individual glyph. options.angelica.fontconfig.font_aa_strength.tooltip=The spacing of samples used in font antialiasing. High values may cause fonts to look blurry, low values may cause aliasing. See what works best with your settings. options.angelica.fontconfig.aamode.tooltip=The font antialiasing mode. Can significantly improve the appearance and readability of text that's being scaled or viewed at oblique angles, at the expense of some performance. +options.angelica.fontconfig.font_brightness.tooltip=Affects the thickness of antialiased fonts. Can improve visibility of some text. A value of 0.5 leaves the alpha untouched. Extreme values might make text look jagged. options.angelica.fontconfig.custom_font_scale.tooltip=A multiplier that affects the scale of custom fonts. Adjust this if text in your font of choice looks under-/over-sized relative to text that does not use custom fonts. options.angelica.fontconfig.shadow_offset_unicode.tooltip=A shadow offset multiplier applied only to the Unicode font. Set this to 1.0x if, for example, you use a texture pack that replaces portions of the Unicode font with MC lookalikes. options.angelica.hudCaching=HUD Caching diff --git a/src/main/resources/assets/angelica/shaders/fontFilter.fsh b/src/main/resources/assets/angelica/shaders/fontFilter.fsh index e4d2ac3e0..77877a460 100644 --- a/src/main/resources/assets/angelica/shaders/fontFilter.fsh +++ b/src/main/resources/assets/angelica/shaders/fontFilter.fsh @@ -3,6 +3,7 @@ uniform sampler2D sampler; uniform int aaMode; uniform float strength; +uniform float fontBrightness; uniform float alphaTestRef; in vec4 color; @@ -12,22 +13,17 @@ in vec2 texCoord; out vec4 fragColor; /* -Hacky MSAA and anisotropic filtering. Cursed beyond belief. There _may_ have been simpler means of -achieving the produced effects, but this appears to work without noticeable performance losses. +Hacky multisampling and fake anisotropic filtering. Cursed beyond belief. There _may_ have been simpler +means of achieving the produced effects, but this appears to work without noticeable performance losses. */ -float totalWt; - float txSample(vec2 uv, float du, float dv, float factorU, float factorV) { - float distSquared = sqrt(du * du + dv * dv); - float weight = exp(-distSquared / 6.0); - totalWt += weight; float finalU = uv.x + factorU * du; float finalV = uv.y + factorV * dv; if (finalU < tB.x || finalU > tB.y || finalV < tB.z || finalV > tB.w) { return 0.0; } - return weight * texture(sampler, vec2(finalU, finalV)).a; + return texture(sampler, vec2(finalU, finalV)).a; } void main() { @@ -39,15 +35,15 @@ void main() { col.a = original_alpha * texture(sampler, texCoord).a; } else { vec2 texScaled = texCoord * strength; - float res = 0.0; float fu = abs(dFdx(texScaled.x)) + abs(dFdy(texScaled.x)); float fv = abs(dFdx(texScaled.y)) + abs(dFdy(texScaled.y)); - totalWt = 0.0; + float res = 0.0; if (aaMode == 1) { res += txSample(texCoord, 2.0, 6.0, fu, fv); res += txSample(texCoord, 6.0, -2.0, fu, fv); res += txSample(texCoord, -2.0, -6.0, fu, fv); res += txSample(texCoord, -6.0, 2.0, fu, fv); + res /= 4.0; } else { res += txSample(texCoord, 1.0, 1.0, fu, fv); res += txSample(texCoord, -1.0, -3.0, fu, fv); @@ -65,8 +61,10 @@ void main() { res += txSample(texCoord, 7.0, -4.0, fu, fv); res += txSample(texCoord, 6.0, 7.0, fu, fv); res += txSample(texCoord, -7.0, -8.0, fu, fv); + res /= 16.0; } - res /= totalWt; + float b = fontBrightness; + res = (b * res) / (b * res + (1 - b) * (1 - res)); col.a = original_alpha * res; } } diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/fontrenderer/MixinFontRenderer.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/fontrenderer/MixinFontRenderer.java index 65a7de77f..2ee1145ec 100644 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/fontrenderer/MixinFontRenderer.java +++ b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/fontrenderer/MixinFontRenderer.java @@ -111,9 +111,6 @@ public abstract class MixinFontRenderer implements FontRendererAccessor, IFontPa @Shadow protected abstract String bidiReorder(String p_147647_1_); - @Shadow(remap = false) - protected abstract void bindTexture(ResourceLocation location); - @Unique public BatchingFontRenderer angelica$batcher; @@ -191,9 +188,6 @@ public abstract class MixinFontRenderer implements FontRendererAccessor, IFontPa return angelica$batcher; } - @Override - public void angelica$bindTexture(ResourceLocation location) { this.bindTexture(location); } - @Inject(method = "getCharWidth", at = @At("HEAD"), cancellable = true) public void getCharWidth(char c, CallbackInfoReturnable cir) { cir.setReturnValue((int) angelica$getBatcher().getCharWidthFine(c)); diff --git a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/fontrenderer/MixinMCResourceAccessor.java b/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/fontrenderer/MixinMCResourceAccessor.java deleted file mode 100644 index 3bfb77936..000000000 --- a/src/mixin/java/com/gtnewhorizons/angelica/mixins/early/angelica/fontrenderer/MixinMCResourceAccessor.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.gtnewhorizons.angelica.mixins.early.angelica.fontrenderer; - -import com.gtnewhorizons.angelica.mixins.interfaces.ResourceAccessor; -import net.minecraft.client.Minecraft; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -import java.util.List; - -@Mixin(Minecraft.class) -public class MixinMCResourceAccessor implements ResourceAccessor { - @Shadow - private List defaultResourcePacks; - - @Override - public List angelica$getDefaultResourcePacks() { - return defaultResourcePacks; - } -}