mirror of
https://github.com/chylex/Better-Controls.git
synced 2024-11-24 16:42:45 +01:00
Compare commits
2 Commits
476689deb9
...
761fdb76da
Author | SHA1 | Date | |
---|---|---|---|
761fdb76da | |||
d721d6254d |
@ -1,3 +1,5 @@
|
|||||||
|
import org.gradle.jvm.tasks.Jar
|
||||||
|
|
||||||
val modId: String by project
|
val modId: String by project
|
||||||
val minecraftVersion: String by project
|
val minecraftVersion: String by project
|
||||||
val fabricVersion: String by project
|
val fabricVersion: String by project
|
||||||
@ -45,6 +47,11 @@ tasks.jar {
|
|||||||
exclude("com/terraformersmc/modmenu/")
|
exclude("com/terraformersmc/modmenu/")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.remapJar {
|
tasks.register<Jar>("uncompressedRemapJar") {
|
||||||
archiveVersion.set(tasks.jar.get().archiveVersion)
|
group = "fabric"
|
||||||
|
|
||||||
|
from(tasks.remapJar.map { it.outputs.files.map(::zipTree) })
|
||||||
|
|
||||||
|
archiveClassifier.set("uncompressed")
|
||||||
|
entryCompression = ZipEntryCompression.STORED // Reduces size of multiloader jar.
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
@ -6,7 +6,7 @@
|
|||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"license": "${license}",
|
"license": "${license}",
|
||||||
|
|
||||||
"icon": "assets/bettercontrols/icon.png",
|
"icon": "assets/${id}/logo.png",
|
||||||
|
|
||||||
"authors": [
|
"authors": [
|
||||||
"${author}"
|
"${author}"
|
||||||
@ -18,7 +18,7 @@
|
|||||||
"sources": "${sourcesURL}"
|
"sources": "${sourcesURL}"
|
||||||
},
|
},
|
||||||
|
|
||||||
"environment": "client",
|
"environment": "${sidesForFabric}",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"client": [ "chylex.bettercontrols.BetterControlsMod" ],
|
"client": [ "chylex.bettercontrols.BetterControlsMod" ],
|
||||||
"modmenu": [ "chylex.bettercontrols.compatibility.ModMenuSupport" ]
|
"modmenu": [ "chylex.bettercontrols.compatibility.ModMenuSupport" ]
|
||||||
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
"mixins": [{
|
"mixins": [{
|
||||||
"config": "${id}.mixins.json",
|
"config": "${id}.mixins.json",
|
||||||
"environment": "client"
|
"environment": "${sidesForFabric}"
|
||||||
}],
|
}],
|
||||||
|
|
||||||
"depends": {
|
"depends": {
|
||||||
|
@ -11,7 +11,7 @@ displayURL = "${sourcesURL}"
|
|||||||
description = "${description}"
|
description = "${description}"
|
||||||
authors = "${author}"
|
authors = "${author}"
|
||||||
version = "${version}"
|
version = "${version}"
|
||||||
logoFile = "icon.png"
|
logoFile = "assets/${id}/logo.png"
|
||||||
|
|
||||||
[[mixins]]
|
[[mixins]]
|
||||||
config = "${id}.mixins.json"
|
config = "${id}.mixins.json"
|
||||||
@ -21,11 +21,11 @@ modId = "minecraft"
|
|||||||
type = "required"
|
type = "required"
|
||||||
versionRange = "[${minimumMinecraftVersion},)"
|
versionRange = "[${minimumMinecraftVersion},)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "CLIENT"
|
side = "${sidesForNeoForge}"
|
||||||
|
|
||||||
[[dependencies.${id}]]
|
[[dependencies.${id}]]
|
||||||
modId = "neoforge"
|
modId = "neoforge"
|
||||||
type = "required"
|
type = "required"
|
||||||
versionRange = "[${minimumNeoForgeVersion},)"
|
versionRange = "[${minimumNeoForgeVersion},)"
|
||||||
ordering = "NONE"
|
ordering = "NONE"
|
||||||
side = "CLIENT"
|
side = "${sidesForNeoForge}"
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
112
build.gradle.kts
112
build.gradle.kts
@ -1,6 +1,6 @@
|
|||||||
@file:Suppress("ConvertLambdaToReference")
|
@file:Suppress("ConvertLambdaToReference")
|
||||||
|
|
||||||
import org.gradle.api.file.DuplicatesStrategy.EXCLUDE
|
import org.gradle.jvm.tasks.Jar
|
||||||
|
|
||||||
val modId: String by project
|
val modId: String by project
|
||||||
val modName: String by project
|
val modName: String by project
|
||||||
@ -10,6 +10,7 @@ val modVersion: String by project
|
|||||||
val modLicense: String by project
|
val modLicense: String by project
|
||||||
val modSourcesURL: String by project
|
val modSourcesURL: String by project
|
||||||
val modIssuesURL: String by project
|
val modIssuesURL: String by project
|
||||||
|
val modSides: String by project
|
||||||
|
|
||||||
val minecraftVersion: String by project
|
val minecraftVersion: String by project
|
||||||
val mixinVersion: String by project
|
val mixinVersion: String by project
|
||||||
@ -19,7 +20,6 @@ val minimumNeoForgeVersion: String by project
|
|||||||
val minimumFabricVersion: String by project
|
val minimumFabricVersion: String by project
|
||||||
|
|
||||||
val modNameStripped = modName.replace(" ", "")
|
val modNameStripped = modName.replace(" ", "")
|
||||||
val jarVersion = "$minecraftVersion+v$modVersion"
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
idea
|
idea
|
||||||
@ -94,6 +94,38 @@ allprojects {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.jetbrains:annotations:24.1.0")
|
implementation("org.jetbrains:annotations:24.1.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType<ProcessResources> {
|
||||||
|
val (sidesForNeoForge, sidesForFabric) = when (modSides) {
|
||||||
|
"both" -> Pair("BOTH", "*")
|
||||||
|
"client" -> Pair("CLIENT", "client")
|
||||||
|
"server" -> Pair("SERVER", "server")
|
||||||
|
else -> error("Invalid modSides value: $modSides")
|
||||||
|
}
|
||||||
|
|
||||||
|
inputs.property("id", modId)
|
||||||
|
inputs.property("name", modName)
|
||||||
|
inputs.property("description", modDescription)
|
||||||
|
inputs.property("version", modVersion)
|
||||||
|
inputs.property("author", modAuthor)
|
||||||
|
inputs.property("license", modLicense)
|
||||||
|
inputs.property("sourcesURL", modSourcesURL)
|
||||||
|
inputs.property("issuesURL", modIssuesURL)
|
||||||
|
inputs.property("sidesForNeoForge", sidesForNeoForge)
|
||||||
|
inputs.property("sidesForFabric", sidesForFabric)
|
||||||
|
inputs.property("minimumMinecraftVersion", minimumMinecraftVersion)
|
||||||
|
inputs.property("minimumNeoForgeVersion", minimumNeoForgeVersion)
|
||||||
|
inputs.property("minimumFabricVersion", minimumFabricVersion)
|
||||||
|
|
||||||
|
from(rootProject.file("logo.png")) {
|
||||||
|
into("assets/$modId")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<AbstractArchiveTask>().configureEach {
|
||||||
|
isPreserveFileTimestamps = false
|
||||||
|
isReproducibleFileOrder = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
@ -112,37 +144,16 @@ subprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.processResources {
|
tasks.processResources {
|
||||||
inputs.property("id", modId)
|
|
||||||
inputs.property("name", modName)
|
|
||||||
inputs.property("description", modDescription)
|
|
||||||
inputs.property("version", modVersion)
|
|
||||||
inputs.property("author", modAuthor)
|
|
||||||
inputs.property("license", modLicense)
|
|
||||||
inputs.property("sourcesURL", modSourcesURL)
|
|
||||||
inputs.property("issuesURL", modIssuesURL)
|
|
||||||
inputs.property("minimumMinecraftVersion", minimumMinecraftVersion)
|
|
||||||
inputs.property("minimumNeoForgeVersion", minimumNeoForgeVersion)
|
|
||||||
inputs.property("minimumFabricVersion", minimumFabricVersion)
|
|
||||||
|
|
||||||
from(rootProject.sourceSets.main.get().resources) {
|
from(rootProject.sourceSets.main.get().resources) {
|
||||||
expand(inputs.properties)
|
expand(inputs.properties)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.jar {
|
tasks.jar {
|
||||||
archiveVersion.set(jarVersion)
|
entryCompression = ZipEntryCompression.STORED // Reduces size of multiloader jar.
|
||||||
|
|
||||||
from(rootProject.file("LICENSE"))
|
|
||||||
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes(
|
packageInformation(modId, "$modNameStripped-${project.name}")
|
||||||
"Specification-Title" to modId,
|
|
||||||
"Specification-Vendor" to modAuthor,
|
|
||||||
"Specification-Version" to "1",
|
|
||||||
"Implementation-Title" to "$modNameStripped-${project.name}",
|
|
||||||
"Implementation-Vendor" to modAuthor,
|
|
||||||
"Implementation-Version" to modVersion,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,18 +162,55 @@ subprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val copyJars = tasks.register<Copy>("copyJars") {
|
fun Manifest.packageInformation(specificationTitle: String, implementationTitle: String) {
|
||||||
|
attributes(
|
||||||
|
"Specification-Title" to specificationTitle,
|
||||||
|
"Specification-Vendor" to modAuthor,
|
||||||
|
"Specification-Version" to "1",
|
||||||
|
"Implementation-Title" to implementationTitle,
|
||||||
|
"Implementation-Vendor" to modAuthor,
|
||||||
|
"Implementation-Version" to modVersion,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
val multiloaderSources = sourceSets.register("multiloader")
|
||||||
|
|
||||||
|
val multiloaderJar = tasks.register<Jar>("multiloaderJar") {
|
||||||
group = "build"
|
group = "build"
|
||||||
duplicatesStrategy = EXCLUDE
|
|
||||||
|
|
||||||
for (subproject in subprojects) {
|
archiveBaseName.set(modNameStripped)
|
||||||
dependsOn(subproject.tasks.assemble)
|
archiveVersion.set("$minecraftVersion+v$modVersion")
|
||||||
from(subproject.base.libsDirectory.file("${subproject.base.archivesName.get()}-$jarVersion.jar"))
|
|
||||||
|
destinationDirectory = layout.buildDirectory.dir("dist")
|
||||||
|
|
||||||
|
fun includeJar(project: Project, jarTaskName: String) {
|
||||||
|
from(project.tasks.named(jarTaskName).map { it.outputs }) {
|
||||||
|
into("jars")
|
||||||
|
rename { "$modNameStripped-${project.name}.jar" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
into(project.layout.buildDirectory.dir("dist"))
|
findProject(":NeoForge")?.let { includeJar(it, "jar") }
|
||||||
|
findProject(":Fabric")?.let { includeJar(it, "uncompressedRemapJar") }
|
||||||
|
|
||||||
|
from(rootProject.file("LICENSE"))
|
||||||
|
from(multiloaderSources.map { it.output })
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
packageInformation("$modId-multiloader", modNameStripped)
|
||||||
|
attributes("FMLModType" to "GAMELIBRARY")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<ProcessResources>("processMultiloaderResources").configure {
|
||||||
|
inputs.property("group", project.group)
|
||||||
|
inputs.property("jarPrefix", modNameStripped)
|
||||||
|
|
||||||
|
filesMatching(listOf("fabric.mod.json", "META-INF/jarjar/metadata.json")) {
|
||||||
|
expand(inputs.properties)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.assemble {
|
tasks.assemble {
|
||||||
finalizedBy(copyJars)
|
finalizedBy(multiloaderJar)
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ modVersion=1.3.1
|
|||||||
modLicense=MPL-2.0
|
modLicense=MPL-2.0
|
||||||
modSourcesURL=https://github.com/chylex/Better-Controls
|
modSourcesURL=https://github.com/chylex/Better-Controls
|
||||||
modIssuesURL=https://github.com/chylex/Better-Controls/issues
|
modIssuesURL=https://github.com/chylex/Better-Controls/issues
|
||||||
|
modSides=client
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
minecraftVersion=1.21
|
minecraftVersion=1.21
|
||||||
|
13
src/multiloader/resources/META-INF/jarjar/metadata.json
Normal file
13
src/multiloader/resources/META-INF/jarjar/metadata.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"jars": [{
|
||||||
|
"identifier": {
|
||||||
|
"group": "${group}",
|
||||||
|
"artifact": "${id}"
|
||||||
|
},
|
||||||
|
"version": {
|
||||||
|
"artifactVersion": "${version}",
|
||||||
|
"range": "[${version}]"
|
||||||
|
},
|
||||||
|
"path": "jars/${jarPrefix}-NeoForge.jar"
|
||||||
|
}]
|
||||||
|
}
|
34
src/multiloader/resources/fabric.mod.json
Normal file
34
src/multiloader/resources/fabric.mod.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"schemaVersion": 1,
|
||||||
|
"id": "${id}_multiloader",
|
||||||
|
"name": "${name} (Multiloader)",
|
||||||
|
"description": "${description}",
|
||||||
|
"version": "${version}",
|
||||||
|
"license": "${license}",
|
||||||
|
|
||||||
|
"icon": "assets/${id}/logo.png",
|
||||||
|
|
||||||
|
"authors": [
|
||||||
|
"${author}"
|
||||||
|
],
|
||||||
|
|
||||||
|
"contact": {
|
||||||
|
"homepage": "https://chylex.com",
|
||||||
|
"issues": "${issuesURL}",
|
||||||
|
"sources": "${sourcesURL}"
|
||||||
|
},
|
||||||
|
|
||||||
|
"environment": "${sidesForFabric}",
|
||||||
|
|
||||||
|
"jars": [{
|
||||||
|
"file": "jars/${jarPrefix}-Fabric.jar"
|
||||||
|
}],
|
||||||
|
|
||||||
|
"custom": {
|
||||||
|
"modmenu": {
|
||||||
|
"parent": "${id}",
|
||||||
|
"badges": [ "library" ],
|
||||||
|
"update_checker": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user