Skip to content
This repository has been archived by the owner on Dec 28, 2024. It is now read-only.

Improve Build #2

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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")

Expand All @@ -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 {
Expand All @@ -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 })
}
}
Expand All @@ -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
))
}
}

Expand All @@ -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"
Expand All @@ -213,7 +214,6 @@ tasks.shadowJar {
}
exclude("META-INF/versions/**")
mergeServiceFiles()
relocate("io.github.notenoughupdates.moulconfig", "$group.deps.moulconfig")
}

tasks.jar {
Expand Down
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 5 additions & 4 deletions src/main/kotlin/com/ratons/Ratons.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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<Any> = ArrayList()
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/com/ratons/commands/Commands.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<ChatComponentText>()
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/com/ratons/config/ExampleCategory.java
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/com/ratons/config/Features.java
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -14,7 +14,7 @@ public boolean shouldAutoFocusSearchbar() {

@Override
public String getTitle() {
return "Ratons " + Ratons.VERSION;
return Ratons.MOD_NAME + " " + Ratons.VERSION;
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Loading