/*
* Skytils - Hypixel Skyblock Quality of Life Mod
* Copyright (C) 2021 Skytils
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
package skytils.skytilsmod.tweaker
import SkytilsInstallerFrame
import net.minecraftforge.common.ForgeVersion
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin
import org.apache.hc.client5.http.classic.methods.HttpGet
import org.apache.hc.core5.http.io.entity.EntityUtils
import org.spongepowered.asm.launch.MixinBootstrap
import org.spongepowered.asm.mixin.MixinEnvironment
import skytils.skytilsmod.utils.APIUtil
import skytils.skytilsmod.utils.Utils
import skytils.skytilsmod.utils.startsWithAny
import java.awt.Desktop
import java.awt.Image
import java.awt.Toolkit
import java.awt.event.MouseAdapter
import java.awt.event.MouseEvent
import java.io.File
import java.net.URI
import java.net.URL
import javax.swing.*
/**
* Fake loading plugin, called from the java loading plugin
* @see skytils.skytilsmod.tweaker.SkytilsLoadingPlugin
*/
class SkytilsLoadingPluginKt : IFMLLoadingPlugin {
init {
if (System.getProperty("skytils.skipStartChecks") == null) {
// Must use reflection otherwise the "constant" value will be inlined by compiler
if (!runCatching {
MixinBootstrap::class.java.getDeclaredField("VERSION").also { it.isAccessible = true }
.get(null) as String
}.getOrDefault("unknown").startsWithAny("0.7", "0.8")) {
try {
Class.forName("com.mumfrey.liteloader.launch.LiteLoaderTweaker")
showMessage(SkytilsLoadingPlugin.liteloaderUserMessage)
SkytilsLoadingPlugin.exit()
} catch (ignored: ClassNotFoundException) {
showMessage(
SkytilsLoadingPlugin.badMixinVersionMessage + "
The culprit seems to be " + File(
MixinEnvironment::class.java.protectionDomain.codeSource.location.toURI()
).name + "