diff --git a/build.gradle b/build.gradle index 4a2a235..b6ea1ea 100644 --- a/build.gradle +++ b/build.gradle @@ -93,7 +93,8 @@ jar { "TweakClass": "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder": 0, "FMLCorePlugin": "de.florianmichael.viaforge.mixin.MixinLoader", - "FMLCorePluginContainsFMLMod": "true" + "FMLCorePluginContainsFMLMod": "true", + "ForceLoadAsMod": "true" ) enabled = false diff --git a/src/main/java/de/florianmichael/viaforge/ViaForge189.java b/src/main/java/de/florianmichael/viaforge/ViaForge189.java index 094e71b..7c07f13 100644 --- a/src/main/java/de/florianmichael/viaforge/ViaForge189.java +++ b/src/main/java/de/florianmichael/viaforge/ViaForge189.java @@ -18,12 +18,14 @@ package de.florianmichael.viaforge; +import de.florianmichael.viaforge.common.ViaForgeCommon; import de.florianmichael.viaforge.common.platform.VFPlatform; import de.florianmichael.viaforge.provider.ViaForgeGameProfileFetcher; import net.minecraft.client.Minecraft; import net.minecraft.realms.RealmsSharedConstants; import net.minecraft.util.Session; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.raphimc.vialegacy.protocol.release.r1_7_6_10tor1_8.provider.GameProfileFetcher; import java.io.File; @@ -31,8 +33,11 @@ import java.util.function.Supplier; @Mod(modid = "viaforge", name = "ViaForge", acceptableRemoteVersions = "*", clientSideOnly=true, useMetadata=true) public class ViaForge189 implements VFPlatform { - - public static final ViaForge189 PLATFORM = new ViaForge189(); + + @Mod.EventHandler + public void onInit(FMLInitializationEvent event) { + ViaForgeCommon.init(this); + } @Override public int getGameVersion() { diff --git a/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMainMenu.java b/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMainMenu.java index a46a351..b3cf198 100644 --- a/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMainMenu.java +++ b/src/main/java/de/florianmichael/viaforge/mixin/impl/MixinGuiMainMenu.java @@ -19,7 +19,6 @@ package de.florianmichael.viaforge.mixin.impl; import com.viaversion.viaversion.util.Pair; -import de.florianmichael.viaforge.ViaForge189; import de.florianmichael.viaforge.common.ViaForgeCommon; import de.florianmichael.viaforge.common.platform.ViaForgeConfig; import de.florianmichael.viaforge.gui.GuiProtocolSelector; @@ -34,8 +33,6 @@ public class MixinGuiMainMenu extends GuiScreen { @Inject(method = "initGui", at = @At("RETURN")) public void hookViaForgeButton(CallbackInfo ci) { - ViaForgeCommon.init(ViaForge189.PLATFORM); - final ViaForgeConfig config = ViaForgeCommon.getManager().getConfig(); if (config.isShowMainMenuButton()) { final Pair pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);