ConfigScreenProviderMixin breaks config dialog of many mods
Fourmisain opened this issue ยท 2 comments
This is on 1.18.2 but it is most likely the same for 1.19.
With Villager Names installed, the config dialog of many mods such as Axes Are Weapons, Falling Leaves, and Villager Names itself cannot be opened because the construction of the GUI fails, here's an excerpt of the error:
[Render thread/INFO] (net.minecraft.class_2983): [STDERR]: java.lang.ClassCastException: class net.minecraft.class_2588 cannot be cast to class java.lang.String (net.minecraft.class_2588 is in unnamed module of loader net.fabricmc.loader.impl.launch.knot.KnotClassLoader @7c0e2abd; java.lang.String is in module java.base of loader 'bootstrap')
[Render thread/INFO] (net.minecraft.class_2983): [STDERR]: at me.shedaniel.autoconfig.gui.ConfigScreenProvider.localvar$dcf000$addVillagerConfigWarning(ConfigScreenProvider.java:536)
[Render thread/INFO] (net.minecraft.class_2983): [STDERR]: at me.shedaniel.autoconfig.gui.ConfigScreenProvider.get(ConfigScreenProvider.java:136)
[Render thread/INFO] (net.minecraft.class_2983): [STDERR]: at me.shedaniel.rei.impl.client.config.ConfigManagerImpl.getConfigScreen(ConfigManagerImpl.java:461)
[Render thread/INFO] (net.minecraft.class_2983): [STDERR]: at com.terraformersmc.modmenu.ModMenu.getConfigScreen(ModMenu.java:58)
The issue is caused by a change in Cloth Config: ConfigBuilderImpl
's categoryMap
is now a Map<Text, ConfigCategory>
instead of a Map<String, ConfigCategory>
, so the ConfigBuilderImplAccessor
is incorrect and the ConfigScreenProviderMixin tries to cast class_2588
(TranslatableText
) to String
here:
I honestly think this mixin is a really bad idea, you shouldn't be mixing into common library mods, let alone internal Impl
classes, especially not if you just want to add a simple text warning on screen.
There's surely an easier, more compatible way to add that, e.g. for Chat Heads I did something similar where I added a text description for a specific config option. You can check out the code for that here and here, maybe that can be used to add the text warning above the first config entry on each page?
Thanks for explaining. I just fixed this using the GuiRegistry like you said. Will port it to the 1.19 branch soon.