diff --git a/gradle.properties b/gradle.properties index 1a912f5..eb46c8a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ loom.platform=forge # Versions versionMc=1.20.1 versionForge=47.1.3 -versionConnectorExtras=1.4.0 +versionConnectorExtras=1.4.1 # Publishing curseForgeId=913445 diff --git a/modmenu-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/modmenu/ModMenuCompatSetup.java b/modmenu-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/modmenu/ModMenuCompatSetup.java index a0f85f7..8335551 100644 --- a/modmenu-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/modmenu/ModMenuCompatSetup.java +++ b/modmenu-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/modmenu/ModMenuCompatSetup.java @@ -19,14 +19,7 @@ public class ModMenuCompatSetup { private static final Logger LOGGER = LogUtils.getLogger(); private static final String MODMENU_MODID = "modmenu"; - private static boolean initialized = false; - public static void init() { - if (initialized) { - return; - } - initialized = true; - Map<String, ConfigScreenFactory<?>> modFactories = new HashMap<>(); List<Map<String, ConfigScreenFactory<?>>> providedFactories = new ArrayList<>(); FabricLoader.getInstance().getEntrypointContainers(MODMENU_MODID, ModMenuApi.class).forEach(container -> { diff --git a/modmenu-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/modmenu/mixin/MinecraftMixin.java b/modmenu-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/modmenu/mixin/MinecraftMixin.java new file mode 100644 index 0000000..8e12963 --- /dev/null +++ b/modmenu-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/modmenu/mixin/MinecraftMixin.java @@ -0,0 +1,20 @@ +package dev.su5ed.sinytra.connectorextras.modmenu.mixin; + +import com.mojang.realmsclient.client.RealmsClient; +import dev.su5ed.sinytra.connectorextras.modmenu.ModMenuCompatSetup; +import net.minecraft.client.Minecraft; +import net.minecraft.client.main.GameConfig; +import net.minecraft.server.packs.resources.ReloadInstance; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(Minecraft.class) +public class MinecraftMixin { + + @Inject(method = "lambda$new$4", at = @At("HEAD")) + private void initModMenuCompat(RealmsClient realmsclient, ReloadInstance reloadinstance, GameConfig arg, CallbackInfo ci) { + ModMenuCompatSetup.init(); + } +} diff --git a/modmenu-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/modmenu/mixin/ModListScreenMixin.java b/modmenu-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/modmenu/mixin/ModListScreenMixin.java deleted file mode 100644 index b219931..0000000 --- a/modmenu-bridge/src/main/java/dev/su5ed/sinytra/connectorextras/modmenu/mixin/ModListScreenMixin.java +++ /dev/null @@ -1,17 +0,0 @@ -package dev.su5ed.sinytra.connectorextras.modmenu.mixin; - -import dev.su5ed.sinytra.connectorextras.modmenu.ModMenuCompatSetup; -import net.minecraftforge.client.gui.ModListScreen; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(ModListScreen.class) -public class ModListScreenMixin { - - @Inject(method = "init", at = @At("HEAD")) - private void initModMenuCompat(CallbackInfo ci) { - ModMenuCompatSetup.init(); - } -} diff --git a/modmenu-bridge/src/main/resources/mixins.connectorextras_modmenu_bridge.json b/modmenu-bridge/src/main/resources/mixins.connectorextras_modmenu_bridge.json index bea0d6e..e06a145 100644 --- a/modmenu-bridge/src/main/resources/mixins.connectorextras_modmenu_bridge.json +++ b/modmenu-bridge/src/main/resources/mixins.connectorextras_modmenu_bridge.json @@ -4,6 +4,6 @@ "required": true, "package": "dev.su5ed.sinytra.connectorextras.modmenu.mixin", "client": [ - "ModListScreenMixin" + "MinecraftMixin" ] }