From 7b32dd464e05be70462783a73925f74a2f5e163c Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Mon, 27 Nov 2023 17:10:34 +0100 Subject: [PATCH] Hook font renderer fix setting again --- .../injection/mixin/fixes/minecraft/MixinFontStorage.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinFontStorage.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinFontStorage.java index c351507f..03d03352 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinFontStorage.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/MixinFontStorage.java @@ -23,6 +23,8 @@ import com.llamalad7.mixinextras.sugar.Local; import de.florianmichael.viafabricplus.fixes.data.RenderableGlyphDiff; import de.florianmichael.viafabricplus.fixes.replacement.BuiltinEmptyGlyph1_12_2; import de.florianmichael.viafabricplus.protocolhack.ProtocolHack; +import de.florianmichael.viafabricplus.settings.impl.DebugSettings; +import de.florianmichael.viafabricplus.settings.impl.VisualSettings; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import net.minecraft.client.MinecraftClient; @@ -82,7 +84,7 @@ public abstract class MixinFontStorage { @Inject(method = "findGlyph", at = @At("RETURN"), cancellable = true) private void fixBlankGlyph1_12_2(int codePoint, CallbackInfoReturnable cir) { - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) { + if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) { final FontStorage.GlyphPair glyphPair = cir.getReturnValue(); final Glyph glyph1 = glyphPair.glyph(); final Glyph glyph2 = glyphPair.advanceValidatedGlyph(); @@ -106,7 +108,7 @@ public abstract class MixinFontStorage { @Unique private FontStorage.GlyphPair getBlankGlyphPair() { - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) { + if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) { return new FontStorage.GlyphPair(BuiltinEmptyGlyph1_12_2.INSTANCE, BuiltinEmptyGlyph1_12_2.INSTANCE); } return FontStorage.GlyphPair.MISSING; @@ -114,7 +116,7 @@ public abstract class MixinFontStorage { @Unique private GlyphRenderer getBlankGlyphRenderer() { - if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_12_2)) { + if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) { return this.blankGlyphRenderer1_12_2; } return this.blankGlyphRenderer;