Closed A5ho9999 closed 5 days ago
This is because some mods call Font related functions too early, causing ModernUI to load fonts before the resource packs load.
java.lang.Exception: Loading typeface
at icyllis.modernui.mc.fabric.ModernUIFabricClient.checkFirstLoadTypeface(ModernUIFabricClient.java:95) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.ModernUIClient.onGetSelectedTypeface(ModernUIClient.java:306) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.ModernUI.getSelectedTypeface(ModernUI.java:441) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.text.TextLayoutEngine.getFontCollection(TextLayoutEngine.java:1192) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.text.TextLayoutProcessor.handleStyleRun(TextLayoutProcessor.java:832) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.text.TextLayoutProcessor.handleBidiRun(TextLayoutProcessor.java:740) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.text.TextLayoutProcessor.analyzeBidi(TextLayoutProcessor.java:618) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.text.TextLayoutProcessor.createNewLayout(TextLayoutProcessor.java:554) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.text.TextLayoutProcessor.createTextLayout(TextLayoutProcessor.java:423) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.text.TextLayoutEngine.lookupFormattedLayout(TextLayoutEngine.java:1046) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.text.TextLayoutEngine.lookupFormattedLayout(TextLayoutEngine.java:991) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.text.ModernStringSplitter.measureText(ModernStringSplitter.java:99) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at icyllis.modernui.mc.text.ModernStringSplitter.method_27488(ModernStringSplitter.java:67) ~[ModernUI-Fabric-1.20.1-3.10.1.8-universal.jar:?]
at net.minecraft.class_327.method_27525(class_327.java:314) ~[client-intermediary.jar:?]
at net.minecraft.class_304.handler$zzf000$amecsapi$getLocalizedName(class_304.java:618) ~[client-intermediary.jar:?]
at net.minecraft.class_304.method_16007(class_304.java:174) ~[client-intermediary.jar:?]
at net.minecraft.class_310.handler$bbi000$modernfix$replaceSearchTrees(class_310.java:11031) ~[client-intermediary.jar:?]
at net.minecraft.class_310.method_1546(class_310.java) ~[client-intermediary.jar:?]
at net.minecraft.class_310.<init>(class_310.java:586) ~[client-intermediary.jar:?]
at net.minecraft.client.main.Main.main(Main.java:211) ~[1.20.1-fabric-0.14.22.jar:?]
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468) ~[fabric-loader-0.14.22.jar:?]
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.14.22.jar:?]
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.14.22.jar:?]
As you can see, ModernFix has a mixin injection at Minecraft.createSearchTrees
that is trying to replace search trees. It will be replaced with REI provider if REI is intalled (otherwise it is a no-op), and then ModernFix will call KeyMapping.getTranslatedKeyMessage
. The amecs mod has a mixin injection there that is calling Font.width
, which triggers early font loading.
Even if you play without ModernUI, it is meaningless to call Font.width
there, the width will always be 0 because there are no fonts loaded at this moment, and this behavior is not allowed. ModernUI just helps you finding out this bug.
Describe the bug Fails to load custom fonts in a resource pack when following mods are installed. I don't know why it's a combination of these 3 mods that do it, having just 2 of them it works fine, but add a 3rd. It breaks
https://modrinth.com/mod/amecs https://modrinth.com/mod/modernfix https://modrinth.com/mod/rei
To Reproduce Steps to reproduce the behavior:
Expected behavior Register and load custom font from resoucepacks
Screenshots amecs
amecs+modernfix
amecs+modernfix+roughlyenoughitems
modernfix+roughlyenoughitems
![2024-06-12_14 56 21](https://github.com/BloCamLimb/ModernUI/assets/46066364/a87140c4-72dd-4c96-8a40-d972204a2bb6)
Environment