1919import org .jetbrains .annotations .NotNull ;
2020import org .jetbrains .annotations .Nullable ;
2121
22+ import java .lang .reflect .Method ;
2223import java .util .*;
2324import java .util .stream .Collectors ;
2425
@@ -170,6 +171,7 @@ public Set<String> getChildMods() {
170171
171172 @ Override
172173 public boolean hasConfig () {
174+ ensureCarbonConfigsRegistered ();
173175 IModGuiFactory guiFactory = FMLClientHandler .instance ().getGuiFactoryFor (this .info );
174176 if (guiFactory == null ) return false ;
175177 return guiFactory .hasConfigGui ();
@@ -186,6 +188,20 @@ public void openConfigScreen(Minecraft minecraft, GuiScreen parent) {
186188 }
187189 }
188190
191+ private static boolean carbonConfigRegistrationAttempted ;
192+
193+ private static void ensureCarbonConfigsRegistered () {
194+ if (carbonConfigRegistrationAttempted ) return ;
195+ carbonConfigRegistrationAttempted = true ;
196+ try {
197+ Class <?> cls = Class .forName ("carbonconfiglib.impl.internal.EventHandler" );
198+ Method m = cls .getDeclaredMethod ("registerConfigs" );
199+ m .setAccessible (true );
200+ m .invoke (cls .getField ("INSTANCE" ).get (null ));
201+ } catch (ReflectiveOperationException | LinkageError ignored ) {
202+ }
203+ }
204+
189205 @ Override
190206 public void drawUpdateIcon (Minecraft minecraft , Update update , int x , int y ) {
191207 GlStateManager .color (1.0F , 1.0F , 1.0F , 1.0F );
0 commit comments