-
-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Description
Mod loader
Fabric
Minecraft version
1.21.11
Mod version
21.1.1
Modloader version
Loader 0.18.2 + API 0.139.4+1.21.11
Modpack info
No response
[IMPORTANT] If bug:
- I have confirmed this bug is reproducible on a minimal setup, not a modpack with many other mods.
[IMPORTANT] If bug: The latest.log file, not the crash report
https://gist.github.com/bluebear94/dd04c8b9f727c8efb69a783a86da3a85
Issue description
When Caxton 0.9.0-alpha.2+1.21.11-FABRIC is installed alongside Jade, the widths of TextElementImpl objects are miscalculated. This can result in the HUD tooltip appearing too wide:
Issue on Caxton’s repository. I am reporting this both on Caxton’s repository and here because I’m not sure how to best fix this issue.
Steps to reproduce
- Start the game with Jade and Caxton and join a world
- Enable the bundled Inter resource pack
- Place a waxed weathered cut copper stairs block
- Look at that block
Expected behavior: The tooltip is just wide enough to fit the name of the block.
Actual behavior: The tooltip is wider than the name of the block.
Code analysis
- Jade’s
TextElementImplcalculates the width of a text according toDisplayHelper.font() - This returns an instance of
JadeFont(code), which is a subclass ofFont - Constructing a
Fontresults in constructing a correspondingStringSplitter - When a
StringSplitteris constructed, Caxton instantiates a correspondingCaxtonTextHandler(through mixin injection), but at this time, the appropriate font set accessor is not yet known, so the CTH has a dummy accessorCaxtonTextHandlerneeds a font set accessor (aFunction<Identifier, FontSet>derived from the font manager) instead of merely aWidthProviderbecause it requires complex text layout information from Caxton fonts.
- When the
Fontis constructed, Caxton instantiates aCaxtonTextRenderer(again, through mixin injection), which creates the realCaxtonTextHandler(and thereby associates it with the vanillaStringSplitterheld byFont) - After the
Fontconstructor finishes, theJadeFontconstructor sets the splitter to a new instance, which is left with a dummy font set accessor - As a result, when Jade tries to calculate the width of some text, it does so as if no fonts are loaded.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels