diff --git a/build.gradle.kts b/build.gradle.kts index ee818ae..da52a91 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { kotlin("jvm") version "1.5.0-M2" id("com.github.johnrengelman.shadow") version "6.1.0" apply false @@ -14,10 +15,13 @@ architectury { } subprojects { + val shadowC by configurations.creating + tasks.withType(ShadowJar::class) { this.configurations = listOf(shadowC) } apply(plugin = "org.jetbrains.kotlin.jvm") apply(plugin = "forgified-fabric-loom") apply(plugin = "com.github.johnrengelman.shadow") dependencies { + shadowC(kotlin("stdlib-jdk8")) "minecraft"("com.mojang:minecraft:${rootProject.property("minecraft")}") } } @@ -30,13 +34,14 @@ allprojects { sourceCompatibility = JavaVersion.VERSION_1_8 } tasks { - withType(com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar::class) { + jar.get().isEnabled = false + withType(ShadowJar::class) { relocate("kotlin", "${rootProject.group}.kotlin") - relocate("${rootProject.group}.${rootProject.name.toLowerCase()}", "${rootProject.group}.${rootProject.name.toLowerCase()}.${this@allprojects.name}") + archiveClassifier.set("shadow") } withType(Jar::class) { - manifest.attributes["Main-Class"] = "$groupAndName.exec.InstallerKt" - from("$rootDir/LICENSE") + manifest.attributes["Main-Class"] = "$groupAndName.exec.InfoKt" + from("$rootDir/LICENSE.txt") archiveBaseName.set("${rootProject.name}-${rootProject.version}") } withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) { @@ -57,7 +62,12 @@ allprojects { } } withType(net.fabricmc.loom.task.RemapJarTask::class) { - if (!archiveBaseName.get().startsWith("common")) destinationDirectory.set(file("$rootDir/remappedJars")) + val shadowTask = getByName("shadowJar") as ShadowJar + dependsOn(shadowTask) + archiveBaseName.set(shadowTask.archiveBaseName) + if (!archiveBaseName.get().contains("common")) destinationDirectory.set(file("$rootDir/remappedJars")) + input.set(shadowTask.archiveFile) + archiveClassifier.set(this@allprojects.name) } withType(ProcessResources::class) { val modVersionPair: Pair = "mod_version" to (rootProject.version as String) diff --git a/common/src/main/java/fr/username404/snowygui/exec/info.kt b/common/src/main/java/fr/username404/snowygui/exec/info.kt new file mode 100644 index 0000000..703c247 --- /dev/null +++ b/common/src/main/java/fr/username404/snowygui/exec/info.kt @@ -0,0 +1,53 @@ +package fr.username404.snowygui.exec + +import java.awt.* +import javax.swing.JFrame +import javax.swing.JPanel + +private val Background: Color = Color( + 32, // Red + 32, // Green + 135, // Blue + 120 +) + +object ExecObj { + fun createWindow() { + val frame = JFrame("Hey!") + with(frame) { + createInterface(this) + } + } + private fun createInterface(frame: JFrame) { + frame.setLocationRelativeTo(null) + val panel: JPanel = object: JPanel() { + override fun paintComponent(g: Graphics?) { + if (g is Graphics2D) { + val p: Paint = GradientPaint( + 0.0f, + 0.0f, + Background, + width.toFloat(), + height.toFloat(), + Color( + 52, + 170, + 166, + 255 + ), + true + ) + val g2d = g + g2d.paint = p + g2d.fillRect(0, 0, width, height) + } else { + super.paintComponent(g) + } + } + } + } +} + +fun main() { + ExecObj.createWindow() +} \ No newline at end of file diff --git a/common/src/main/java/fr/username404/snowygui/exec/installer.kt b/common/src/main/java/fr/username404/snowygui/exec/installer.kt deleted file mode 100644 index 034a17f..0000000 --- a/common/src/main/java/fr/username404/snowygui/exec/installer.kt +++ /dev/null @@ -1,2 +0,0 @@ -package fr.username404.snowygui.exec - diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 134d36b..362de68 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -16,11 +16,12 @@ dependencies { mappings(loom.officialMojangMappings()) modApi("${Groups.Fabric}:fabric-loader:${rootProject.property("fabric_loader_version")}") modApi("${Groups.FabricApi}:fabric-resource-loader-v0:${rootProject.property("fabric_resource_loader_version")}") + include("${Groups.FabricApi}:fabric-resource-loader-v0:${rootProject.property("fabric_resource_loader_version")}") { isTransitive = false } modRuntime(modCompileOnly("com.terraformersmc:modmenu:${rootProject.property("modmenu_version")}") { exclude(group = Groups.FabricApi, module = "fabric-resource-loader-v0") }) implementation(project(path = ":common")) { isTransitive = false } add("developmentFabric", project(path = ":common")) { isTransitive = false } - shadow(project(path = ":common", configuration = "transformProductionFabric")) { isTransitive = false } + shadowC(project(path = ":common", configuration = "transformProductionFabric")) { isTransitive = false } }; loom { silentMojangMappingsLicense() } diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 4cd3edc..48cdeaa 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -4,5 +4,5 @@ dependencies { forge("net.minecraftforge:forge:${rootProject.architectury.minecraft}-${rootProject.property("forge_version")}") implementation(project(path = ":common")) { isTransitive = false } add("developmentForge", project(path = ":common")) { isTransitive = false } - shadow(project(path = ":common", configuration = "transformProductionForge")) { isTransitive = false } -}; loom { silentMojangMappingsLicense() } + shadowC(project(path = ":common", configuration = "transformProductionForge")) { isTransitive = false } +}; loom { silentMojangMappingsLicense(); useFabricMixin = true }