From 85e8b95dce916c41bd674923f9da0290640a21d3 Mon Sep 17 00:00:00 2001 From: ev chang Date: Sat, 4 Jan 2025 01:36:20 +0900 Subject: [PATCH] Actually fix the kotlin issue MHUtils still cant be used though because nothing in the tweaker should be calling real oneconfig classes --- gradle.properties | 2 +- gradle/libs.versions.toml | 12 ++++++++---- .../oneconfig/internal/legacy/OneConfigTweaker.java | 8 ++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 48cb45754..6c70fee41 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ name=OneConfig mod_id=oneconfig version_major=1 version_minor=0 -version_patch=0-alpha.50 +version_patch=0-alpha.51 polyfrost.defaults.loom=3 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 057cc61a8..49f6cc288 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -77,14 +77,18 @@ nightconfig-yaml = { module = "com.electronwill.night-config:yaml", version.ref nightconfig-json = { module = "com.electronwill.night-config:json", version.ref = "nightconfig" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } -kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } -kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm", version.ref = "kotlinx-coroutines" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } +kotlin-stdlib-jdk7 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk7", version.ref = "kotlin" } +kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } +kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-jvm = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "kotlinx-coroutines" } kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu-jvm", version.ref = "kotlinx-atomicfu" } fabric-language-kotlin = { module = "net.fabricmc:fabric-language-kotlin", version.ref = "fabric-language-kotlin" } [bundles] -kotlin = ["kotlin-reflect", "kotlin-stdlib"] -kotlinx = ["kotlinx-coroutines", "kotlinx-atomicfu"] +kotlin = ["kotlin-reflect", "kotlin-stdlib", "kotlin-stdlib-jdk7", "kotlin-stdlib-jdk8"] +kotlinx = ["kotlinx-coroutines", "kotlinx-coroutines-jvm", "kotlinx-coroutines-jdk8", "kotlinx-atomicfu"] lwjgl = ["lwjgl", "lwjgl-nvg", "lwjgl-opengl", "lwjgl-stb", "lwjgl-tinyfd"] nightconfig = ["nightconfig", "nightconfig-json", "nightconfig-toml", "nightconfig-yaml"] test-core = ["junit", "logging-impl"] diff --git a/versions/src/main/java/org/polyfrost/oneconfig/internal/legacy/OneConfigTweaker.java b/versions/src/main/java/org/polyfrost/oneconfig/internal/legacy/OneConfigTweaker.java index fd00ecd62..cf4020be5 100644 --- a/versions/src/main/java/org/polyfrost/oneconfig/internal/legacy/OneConfigTweaker.java +++ b/versions/src/main/java/org/polyfrost/oneconfig/internal/legacy/OneConfigTweaker.java @@ -33,7 +33,6 @@ import net.minecraftforge.fml.relauncher.CoreModManager; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.polyfrost.oneconfig.api.platform.v1.Platform; import org.spongepowered.asm.launch.MixinBootstrap; import org.spongepowered.asm.mixin.Mixins; @@ -76,7 +75,7 @@ public OneConfigTweaker() { LOGGER.error("failed to setup mixin for {}", sourceFile.path.toString(), t); } } - } else if (!Platform.loader().isDevelopmentEnvironment()) { + } else if (!isDevelopmentEnvironment()) { LOGGER.fatal("Not able to detect jar sources. mixin will NOT work!"); } @@ -262,6 +261,11 @@ public String[] getLaunchArguments() { return new String[0]; } + private static boolean isDevelopmentEnvironment() { + Object o = Launch.blackboard.get("fml.deobfuscatedEnvironment"); + return o != null && (boolean) o; + } + private static class SourceFile { final Path path; final String coreMod;