Completely disable all Font rendering changes in case DashLoader is installed

This commit is contained in:
FlorianMichael 2023-08-24 22:10:46 +02:00
parent 2fcf59bfa3
commit 51538b6fc7
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
4 changed files with 22 additions and 11 deletions

View File

@ -28,10 +28,14 @@ ViaFabricPlus is intended to replace [multiconnect](https://github.com/Earthcomp
### If you encounter any issues, please report them on the [issue tracker](https://github.com/ViaVersion/ViaFabricPlus/issues) or on the ViaVersion [Discord](https://discord.gg/viaversion)
## Known incompatibilities
### Breaks
- ***[ViaFabric (*)](https://github.com/ViaVersion/ViaFabric)***
- ***[krypton (<= 0.2.2)](https://github.com/astei/krypton)***
- ***[MemoryLeakFix (<= 1.1.0)](https://github.com/astei/krypton)***
### Conflicts
- ***[DashLoader (*)](https://github.com/alphaqu/DashLoader/tree/fabric-1.20)*** - Font rendering related fixes aren't working
## List of all clientside related fixes and TODO
<details>
<summary>Click to open</summary>

View File

@ -35,16 +35,15 @@ public class FontRenderer1_12_2 {
public static void init() {
if (DASH_LOADER) return;
// Reload all font renderer storage
ChangeProtocolVersionCallback.EVENT.register(protocolVersion ->
MinecraftClient.getInstance().fontManager.fontStorages.values().forEach(fontStorage ->
RenderSystem.recordRenderCall(() -> ((IFontStorage) fontStorage).viafabricplus_clearCaches())));
}
public static boolean shouldReplaceFontRenderer() {
if (DASH_LOADER) return false;
return VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled();
MinecraftClient.getInstance().fontManager.fontStorages.values().
forEach(fontStorage -> RenderSystem.recordRenderCall(() -> ((IFontStorage) fontStorage).viafabricplus_clearCaches())));
}
/**
* Implementation of a "Very Missing" Glyph which doesn't have any rendering at all ("Missing" in <= 1.12.2)
*/
public enum BuiltinEmptyGlyph1_12_2 implements Glyph {
VERY_MISSING;

View File

@ -17,6 +17,7 @@
*/
package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft;
import de.florianmichael.viafabricplus.base.settings.groups.VisualSettings;
import de.florianmichael.viafabricplus.definition.FontRenderer1_12_2;
import de.florianmichael.viafabricplus.injection.access.IFontStorage;
import de.florianmichael.viafabricplus.mappings.CharacterMappings;
@ -81,10 +82,12 @@ public abstract class MixinFontStorage implements IFontStorage {
@Inject(method = "findGlyph", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/Font;getGlyph(I)Lnet/minecraft/client/font/Glyph;"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
public void injectFindGlyph(int codePoint, CallbackInfoReturnable<FontStorage.GlyphPair> cir, Glyph glyph, Iterator var3, Font font) {
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4) && this.id.getNamespace().equals("minecraft")) {
if (FontRenderer1_12_2.DASH_LOADER || !this.id.getNamespace().equals("minecraft")) return;
if (ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
if (viafabricplus_isForbiddenCharacter(font, codePoint)) cir.setReturnValue(FontStorage.GlyphPair.MISSING);
if (FontRenderer1_12_2.shouldReplaceFontRenderer() && cir.getReturnValue() == FontStorage.GlyphPair.MISSING) {
if (VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled() && cir.getReturnValue() == FontStorage.GlyphPair.MISSING) {
cir.setReturnValue(new FontStorage.GlyphPair(FontRenderer1_12_2.BuiltinEmptyGlyph1_12_2.VERY_MISSING, FontRenderer1_12_2.BuiltinEmptyGlyph1_12_2.VERY_MISSING));
}
}
@ -92,10 +95,12 @@ public abstract class MixinFontStorage implements IFontStorage {
@Inject(method = "findGlyphRenderer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/Font;getGlyph(I)Lnet/minecraft/client/font/Glyph;"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true)
public void injectFindGlyphRenderer(int codePoint, CallbackInfoReturnable<GlyphRenderer> cir, Iterator var2, Font font) {
if (!viafabricplus_obfuscation && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4) && this.id.getNamespace().equals("minecraft")) {
if (FontRenderer1_12_2.DASH_LOADER || !this.id.getNamespace().equals("minecraft")) return;
if (!viafabricplus_obfuscation && ProtocolHack.getTargetVersion().isOlderThanOrEqualTo(VersionEnum.r1_19_4)) {
if (viafabricplus_isForbiddenCharacter(font, codePoint)) cir.setReturnValue(this.blankGlyphRenderer);
if (FontRenderer1_12_2.shouldReplaceFontRenderer() && cir.getReturnValue() == this.blankGlyphRenderer) {
if (VisualSettings.INSTANCE.changeFontRendererBehaviour.isEnabled() && cir.getReturnValue() == this.blankGlyphRenderer) {
cir.setReturnValue(FontRenderer1_12_2.BuiltinEmptyGlyph1_12_2.VERY_MISSING.bake(this::getGlyphRenderer));
}
}

View File

@ -42,5 +42,8 @@
"viafabric": "*",
"memoryleakfix": "<=1.1.0",
"krypton": "<=0.2.2"
},
"conflicts": {
"dashloader": "*"
}
}