diff --git a/build.gradle.kts b/build.gradle.kts index 2b9d9cd..fd80901 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,16 +11,25 @@ plugins { kotlin("jvm") version "1.9.0" kotlin("plugin.serialization") version "1.8.0" id("com.bnorm.power.kotlin-power-assert") version "0.13.0" + id("net.kyori.blossom") version "1.3.2" } -val group = "com.ratons" -val mixinGroup = "$group.mixin" +//Constants: +val mod_name: String by project +val mod_version: String by project +val mod_id: String by project +val skyhanni_version: String by project -// the modid and version here are used on the compiled far -val modid = "ratons" -val version = "0.0.1" +blossom { + replaceToken("@MOD_VER@", mod_version) + replaceToken("@MOD_NAME@", mod_name) + replaceToken("@MOD_ID@", mod_id) +} -val skyHanniVersion = "0.27.Beta.4" +group = "com.$mod_id" +version = mod_version +val modid = mod_id +val skyHanniVersion = skyhanni_version val gitHash by lazy { val baos = ByteArrayOutputStream() @@ -85,18 +94,13 @@ dependencies { mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9") forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9") - implementation(kotlin("stdlib-jdk8")) headlessLwjgl(libs.headlessLwjgl) - // If you don't want mixins, remove these lines - shadowImpl("org.spongepowered:mixin:0.7.11-SNAPSHOT") { isTransitive = false } annotationProcessor("org.spongepowered:mixin:0.8.4-SNAPSHOT") - implementation(kotlin("stdlib-jdk8")) - // If you don't want to log in with your real minecraft account, remove this line runtimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.2") @@ -117,9 +121,6 @@ dependencies { exclude(group = "null", module = "unspecified") isTransitive = false } - - shadowModImpl(libs.moulconfig) - shadowImpl("org.jetbrains.kotlin:kotlin-reflect:1.9.0") } kotlin { @@ -138,7 +139,6 @@ loom { property("mixin.debug", "true") property("devauth.configDir", rootProject.file(".devauth").absolutePath) arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") - arg("--tweakClass", "io.github.notenoughupdates.moulconfig.tweaker.DevelopmentResourceTweaker") arg("--mods", devenvMod.resolve().joinToString(",") { it.relativeTo(file("run")).path }) } } @@ -164,14 +164,15 @@ loom { } tasks.processResources { + inputs.property("mod_id", mod_id) + inputs.property("mod_name", mod_name) inputs.property("version", version) filesMatching("mcmod.info") { - expand( - mapOf( - "modid" to modid, - "version" to version - ) - ) + expand(mapOf( + "mod_id" to mod_id, + "mod_name" to mod_name, + "version" to version + )) } } @@ -186,7 +187,7 @@ tasks.withType(JavaCompile::class) { tasks.withType(Jar::class) { destinationDirectory.set(project.layout.buildDirectory.dir("badjars")) - archiveBaseName.set("$modid") + archiveBaseName.set(mod_id) manifest.attributes.run { this["FMLCorePluginContainsFMLMod"] = "true" this["ForceLoadAsMod"] = "true" @@ -213,7 +214,6 @@ tasks.shadowJar { } exclude("META-INF/versions/**") mergeServiceFiles() - relocate("io.github.notenoughupdates.moulconfig", "$group.deps.moulconfig") } tasks.jar { diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..49c3a76 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,7 @@ +mod_name = Rat-ons +mod_id = ratons +mod_version = 0.0.1 +skyhanni_version = 0.27.Beta.4 + +loom.platform=forge +org.gradle.jvmargs=-Xmx4g diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 634e490..cfa53cc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,12 +1,8 @@ [versions] -libautoupdate = "1.3.1" -moulconfig = "3.0.0-beta.7" headlessLwjgl = "1.7.2" jbAnnotations = "24.1.0" [libraries] -moulconfig = { module = "org.notenoughupdates.moulconfig:legacy", version.ref = "moulconfig" } -libautoupdate = { module = "moe.nea:libautoupdate", version.ref = "libautoupdate" } headlessLwjgl = { module = "com.github.3arthqu4ke.HeadlessMc:headlessmc-lwjgl", version.ref = "headlessLwjgl" } jbAnnotations = { module = "org.jetbrains:annotations", version.ref = "jbAnnotations" } hotswapagentforge = { module = "moe.nea:hotswapagent-forge", version = "1.0.1" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 53aabd1..0bc4520 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -8,6 +8,7 @@ pluginManagement { maven("https://maven.minecraftforge.net/") maven("https://repo.spongepowered.org/maven/") maven("https://repo.sk1er.club/repository/maven-releases/") + maven("https://repo.polyfrost.org/releases") } resolutionStrategy { eachPlugin { diff --git a/src/main/kotlin/com/ratons/Ratons.kt b/src/main/kotlin/com/ratons/Ratons.kt index 8529c7a..e786c83 100644 --- a/src/main/kotlin/com/ratons/Ratons.kt +++ b/src/main/kotlin/com/ratons/Ratons.kt @@ -1,10 +1,10 @@ package com.ratons +import at.hannibal2.skyhanni.deps.moulconfig.managed.ManagedConfig import at.hannibal2.skyhanni.events.SecondPassedEvent import com.ratons.commands.Commands import com.ratons.config.Features import com.ratons.features.misc.ExampleFeature -import io.github.notenoughupdates.moulconfig.managed.ManagedConfig import net.minecraft.client.Minecraft import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.common.Mod @@ -53,13 +53,14 @@ class Ratons { } companion object { - const val MOD_ID = "ratons" - const val VERSION = "0.0.1" + const val MOD_ID = "@MOD_ID@" + const val VERSION = "@MOD_VER@" + const val MOD_NAME = "@MOD_NAME@" const val HIDE_MOD_ID: Boolean = true @JvmField - val logger: Logger = LogManager.getLogger("Ratons") + val logger: Logger = LogManager.getLogger(MOD_NAME) @JvmField val modules: MutableList = ArrayList() diff --git a/src/main/kotlin/com/ratons/commands/Commands.kt b/src/main/kotlin/com/ratons/commands/Commands.kt index f478200..1254708 100644 --- a/src/main/kotlin/com/ratons/commands/Commands.kt +++ b/src/main/kotlin/com/ratons/commands/Commands.kt @@ -2,13 +2,13 @@ package com.ratons.commands import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.GuiEditManager +import at.hannibal2.skyhanni.deps.moulconfig.gui.GuiScreenElementWrapper import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.StringUtils.splitLines import at.hannibal2.skyhanni.utils.chat.Text import at.hannibal2.skyhanni.utils.chat.Text.hover import at.hannibal2.skyhanni.utils.chat.Text.suggest import com.ratons.Ratons -import io.github.notenoughupdates.moulconfig.gui.GuiScreenElementWrapper import net.minecraft.command.CommandBase import net.minecraft.command.ICommandSender import net.minecraft.util.ChatComponentText @@ -65,9 +65,9 @@ object Commands { if (args.size == 1) { val searchTerm = args[0].lowercase() filter = { it.lowercase().contains(searchTerm) } - title = "Rat-ons commands with '§e$searchTerm§7'" + title = "${Ratons.MOD_NAME} commands with '§e$searchTerm§7'" } else { - title = "All Rat-ons commands" + title = "All ${Ratons.MOD_NAME} commands" } val components = mutableListOf() diff --git a/src/main/kotlin/com/ratons/config/ExampleCategory.java b/src/main/kotlin/com/ratons/config/ExampleCategory.java index b14d3f6..72900b1 100644 --- a/src/main/kotlin/com/ratons/config/ExampleCategory.java +++ b/src/main/kotlin/com/ratons/config/ExampleCategory.java @@ -1,10 +1,10 @@ package com.ratons.config; import at.hannibal2.skyhanni.config.core.config.Position; +import at.hannibal2.skyhanni.deps.moulconfig.annotations.ConfigEditorBoolean; +import at.hannibal2.skyhanni.deps.moulconfig.annotations.ConfigLink; +import at.hannibal2.skyhanni.deps.moulconfig.annotations.ConfigOption; import com.google.gson.annotations.Expose; -import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; -import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; -import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; public class ExampleCategory { diff --git a/src/main/kotlin/com/ratons/config/Features.java b/src/main/kotlin/com/ratons/config/Features.java index a32ff59..8530451 100644 --- a/src/main/kotlin/com/ratons/config/Features.java +++ b/src/main/kotlin/com/ratons/config/Features.java @@ -1,9 +1,9 @@ package com.ratons.config; +import at.hannibal2.skyhanni.deps.moulconfig.Config; +import at.hannibal2.skyhanni.deps.moulconfig.annotations.Category; import com.ratons.Ratons; import com.google.gson.annotations.Expose; -import io.github.notenoughupdates.moulconfig.Config; -import io.github.notenoughupdates.moulconfig.annotations.Category; public class Features extends Config { @@ -14,7 +14,7 @@ public boolean shouldAutoFocusSearchbar() { @Override public String getTitle() { - return "Ratons " + Ratons.VERSION; + return Ratons.MOD_NAME + " " + Ratons.VERSION; } @Override diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index a57d966..9123b9c 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,7 +1,7 @@ [ { - "modid": "${modid}", - "name": "Rat-ons", + "modid": "${mod_id}", + "name": "${mod_name}", "description": "Silly little mod with silly little features.", "version": "${version}", "mcversion": "1.8.9",