Use a shadowC configuration, make an info window instead of an "installer", and include fabric-resource-loader-v0.
This commit is contained in:
parent
1c22266d7c
commit
3439da3e6b
|
@ -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<String, String> = "mod_version" to (rootProject.version as String)
|
||||
|
|
|
@ -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()
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
package fr.username404.snowygui.exec
|
||||
|
|
@ -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() }
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
|
Loading…
Reference in New Issue