mirror of
https://github.com/ViaVersion/ViaForge.git
synced 2024-11-23 12:15:25 +01:00
Load mod via Forge event (#96)
* fix crash with CustomMainMenu mod * move loading to a Forge event * cleanup * Force load as mod --------- Co-authored-by: EnZaXD <florian.michael07@gmail.com>
This commit is contained in:
parent
fee801a9cd
commit
6b6ae4fe32
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -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<Integer, Integer> pos = config.getViaForgeButtonPosition().getPosition(this.width, this.height);
|
||||
|
Loading…
Reference in New Issue
Block a user