From 7278a699aa5eb10e58d97d7c7ca286bd65e50c9d Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sun, 30 Mar 2025 16:56:46 +0700 Subject: [PATCH] Remove "kommons-mc" workaround module --- .idea/gradle.xml | 1 - gradle.properties | 2 +- kommons-mc/build.gradle.kts | 72 ------------------- .../ru/dbotthepony/kommons/KommonsMod.java | 40 ----------- .../src/main/resources/META-INF/mods.toml | 10 --- kommons-mc/src/main/resources/pack.mcmeta | 6 -- settings.gradle.kts | 1 - 7 files changed, 1 insertion(+), 131 deletions(-) delete mode 100644 kommons-mc/build.gradle.kts delete mode 100644 kommons-mc/src/main/java/ru/dbotthepony/kommons/KommonsMod.java delete mode 100644 kommons-mc/src/main/resources/META-INF/mods.toml delete mode 100644 kommons-mc/src/main/resources/pack.mcmeta diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 413be3c..1c92659 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -11,7 +11,6 @@ diff --git a/gradle.properties b/gradle.properties index 0c83731..e21ab54 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ kotlin.code.style=official specifyKotlinAsDependency=false projectGroup=ru.dbotthepony.kommons -projectVersion=3.8.0 +projectVersion=3.9.0 guavaDepVersion=33.0.0 gsonDepVersion=2.8.9 diff --git a/kommons-mc/build.gradle.kts b/kommons-mc/build.gradle.kts deleted file mode 100644 index 5933a1c..0000000 --- a/kommons-mc/build.gradle.kts +++ /dev/null @@ -1,72 +0,0 @@ - -// this whole shit is required because you can't have non-mods be -// loaded on the GAME layer in Minecraft Forge, and hence, -// Kommons can not see Kotlin at runtime (because Kommons being -// loaded with system classloader, while Kotlin is loaded by -// FML classloader). - -plugins { - kotlin("jvm") - id("net.minecraftforge.gradle").version("[6.0.14,6.2)") - `maven-publish` -} - -repositories { - mavenCentral() -} - -dependencies { - minecraft("net.minecraftforge:forge:1.20.2-48.1.0") - - testImplementation("org.jetbrains.kotlin:kotlin-test") - - implementation(project(":")) { setTransitive(false) } - implementation(project(":gson")) { setTransitive(false) } - implementation(project(":guava")) { setTransitive(false) } -} - -tasks.jar { - dependsOn(":jar") - dependsOn(":gson:jar") - dependsOn(":guava:jar") - from(zipTree(project(":").tasks.jar.get().outputs.files.asPath)) - from(zipTree(project(":gson").tasks.jar.get().outputs.files.asPath)) - from(zipTree(project(":guava").tasks.jar.get().outputs.files.asPath)) -} - -tasks.sourceJar { - from(project(":").sourceSets.main.get().allSource) - from(project(":gson").sourceSets.main.get().allSource) - from(project(":guava").sourceSets.main.get().allSource) -} - -minecraft { - mappings("official", "1.20.2") -} - -val projectVersion: String by project - -publishing { - publications { - create("mavenJava") { - from(components["java"]) - artifact(tasks["sourceJar"]) - artifactId = "kommons-mc" - - pom { - dependencies { - - } - } - } - } -} - -tasks.withType(ProcessResources::class.java) { - val replaceProperties = mapOf("mod_version" to projectVersion) - inputs.properties(replaceProperties) - - filesMatching(arrayListOf("META-INF/mods.toml")) { - expand(replaceProperties) - } -} diff --git a/kommons-mc/src/main/java/ru/dbotthepony/kommons/KommonsMod.java b/kommons-mc/src/main/java/ru/dbotthepony/kommons/KommonsMod.java deleted file mode 100644 index f37484b..0000000 --- a/kommons-mc/src/main/java/ru/dbotthepony/kommons/KommonsMod.java +++ /dev/null @@ -1,40 +0,0 @@ -package ru.dbotthepony.kommons; - -import kotlin.KotlinVersion; -import net.minecraftforge.fml.common.Mod; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -@Mod("kommons") -public class KommonsMod { - private static final Logger LOGGER = LogManager.getLogger(); - - private static void checkIfKotlinIsInstalled() { - if (!KotlinVersion.CURRENT.isAtLeast(1, 8, 0)) { - throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 1.9.0 is required."); - } - } - - public KommonsMod() { - try { - checkIfKotlinIsInstalled(); - } catch (Throwable err) { - if (err instanceof NoClassDefFoundError) { - for (int i = 0; i < 16; i++) - LOGGER.fatal("Kommons requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge"); - - LOGGER.fatal("Kommons requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge", err); - throw new RuntimeException("Kommons requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge"); - } - - for (int i = 0; i < 16; i++) - LOGGER.fatal("Kommons' Kotlin version is not satisfied, get newer Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge"); - - LOGGER.fatal("Kommons' Kotlin version is not satisfied, get newer Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge", err); - - throw err; - } - - LOGGER.info("Kommons seems to be loaded"); - } -} diff --git a/kommons-mc/src/main/resources/META-INF/mods.toml b/kommons-mc/src/main/resources/META-INF/mods.toml deleted file mode 100644 index 60554de..0000000 --- a/kommons-mc/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,10 +0,0 @@ - -modLoader="javafml" -loaderVersion="[41,)" -license="2 Clause BSD" -[[mods]] #mandatory -modId="kommons" -version="${mod_version}" -displayName="Kommons" -authors="DBotThePony" -description='''Adapter "mod" to load my library "Kommons" in minecraft environment''' diff --git a/kommons-mc/src/main/resources/pack.mcmeta b/kommons-mc/src/main/resources/pack.mcmeta deleted file mode 100644 index 98ea59b..0000000 --- a/kommons-mc/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "Kommons resources", - "pack_format": 18 - } -} diff --git a/settings.gradle.kts b/settings.gradle.kts index be6a8e5..ad6c780 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -22,4 +22,3 @@ plugins { rootProject.name = "kommons" include("guava") include("gson") -include("kommons-mc")