diff --git a/.gitignore b/.gitignore index df90d1d..af3a5e4 100644 --- a/.gitignore +++ b/.gitignore @@ -46,9 +46,10 @@ local.properties .architectury-transformer\debug.log .architectury-transformer/debug.log -# YOU CAN REMOVE EVERYTHING ELSE AFTER THAT LINE, that is only for template renaming - - +# YOU CAN REMOVE EVERYTHING ELSE AFTER THAT LINE, that is only for template renaming script +# YOU CAN REMOVE EVERYTHING ELSE AFTER THAT LINE, that is only for template renaming script +# YOU CAN REMOVE EVERYTHING ELSE AFTER THAT LINE, that is only for template renaming script +# YOU CAN REMOVE EVERYTHING ELSE AFTER THAT LINE, that is only for template renaming script ## Ignore Visual Studio temporary files, build results, and diff --git a/README.md b/README.md index d36f7d5..0268ccc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,23 @@ # Stonecutter template +This template allows you create multiloader multitemplate mod using stonecutter and architectury + +It is based on my CustomCursor project + +To change versions check settings.gradle.kts + +You can use c# script to automatically change all template names. +Open RenameTemplate.cs, change names in replacements array and run "dotnet run" in this directory +I would highly recommend to do this before opening project in your IDE, and then remove all c# related files from project +(obj and bin folders, .csproj and script itself). Also you can remove c# stuff from .gitignore (there is comment for that) + +If you have some issues with template ping me in [Kiku's realm](https://discord.gg/TBgNUCfryS) or official fabric discord + +Currently supported versions these, +but you can easily add other versions if you need that +- 1.20.1, fabric, lexforge +- 1.20.4, fabric, neoforge +- 1.21.1, fabric, neoforge +- 1.21.3, fabric, neoforge +- 1.21.4, fabric, neoforge + diff --git a/RenameTemplate.cs b/RenameTemplate.cs index b3a5511..69bedde 100644 --- a/RenameTemplate.cs +++ b/RenameTemplate.cs @@ -8,7 +8,7 @@ var replacements = new[] { //ORDER MATTERS - new { Old = "com.example.template", New = "io.github.cooldev.coolmod" }, //change mod package + new { Old = "com.example", New = "io.github.cooldev" }, //change mod package new { Old = "template", New = "coolmod" }, //change modid new { Old = "Template", New = "Cool Mod" }, //change mod display name // ↕ <- Letter L is different case here diff --git a/build.gradle.kts b/build.gradle.kts index 5da5fb1..a40045a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -20,7 +20,7 @@ architectury.common(stonecutter.tree.branches.mapNotNull { if (stonecutter.current.project !in it) null else it.prop("loom.platform") }) -repositories{ +repositories { maven("https://maven.neoforged.net/releases/") //modmenu @@ -70,7 +70,7 @@ loom { options.put("mark-corresponding-synthetics", "1") } } - if(loader == "forge") { + if (loader == "forge") { forge.mixinConfigs( "template-common.mixins.json", "template-forge.mixins.json", @@ -92,8 +92,7 @@ publishMods { file = project.tasks.remapJar.get().archiveFile dryRun = modrinthToken == null || curseforgeToken == null - displayName = - "${mod.name} ${loader.replaceFirstChar { it.uppercase() }} ${property("mod.mc_title")}-${mod.version}" + displayName = "${mod.name} ${loader.replaceFirstChar { it.uppercase() }} ${property("mod.mc_title")}-${mod.version}" version = mod.version changelog = rootProject.file("CHANGELOG.md").readText() type = BETA @@ -124,8 +123,7 @@ publishMods { java { withSourcesJar() - val java = if (stonecutter.eval(minecraft, ">=1.20.5")) - JavaVersion.VERSION_21 else JavaVersion.VERSION_17 + val java = if (stonecutter.eval(minecraft, ">=1.20.5")) JavaVersion.VERSION_21 else JavaVersion.VERSION_17 targetCompatibility = java sourceCompatibility = java } @@ -151,20 +149,43 @@ tasks.jar { archiveClassifier = "dev" } +val buildAndCollect = tasks.register("buildAndCollect") { + group = "versioned" + description = "Must run through 'chiseledBuild'" + from(tasks.remapJar.get().archiveFile, tasks.remapSourcesJar.get().archiveFile) + into(rootProject.layout.buildDirectory.file("libs/${mod.version}/$loader")) + dependsOn("build") +} + +if (stonecutter.current.isActive) { + rootProject.tasks.register("buildActive") { + group = "project" + dependsOn(buildAndCollect) + } + + rootProject.tasks.register("runActive") { + group = "project" + dependsOn(tasks.named("runClient")) + } +} + tasks.processResources { - properties(listOf("fabric.mod.json"), + properties( + listOf("fabric.mod.json"), "id" to mod.id, "name" to mod.name, "version" to mod.version, "minecraft" to mod.prop("mc_dep_fabric") ) - properties(listOf("META-INF/mods.toml", "pack.mcmeta"), + properties( + listOf("META-INF/mods.toml", "pack.mcmeta"), "id" to mod.id, "name" to mod.name, "version" to mod.version, "minecraft" to mod.prop("mc_dep_forgelike") ) - properties(listOf("META-INF/neoforge.mods.toml", "pack.mcmeta"), + properties( + listOf("META-INF/neoforge.mods.toml", "pack.mcmeta"), "id" to mod.id, "name" to mod.name, "version" to mod.version, @@ -176,11 +197,3 @@ tasks.build { group = "versioned" description = "Must run through 'chiseledBuild'" } - -tasks.register("buildAndCollect") { - group = "versioned" - description = "Must run through 'chiseledBuild'" - from(tasks.remapJar.get().archiveFile, tasks.remapSourcesJar.get().archiveFile) - into(rootProject.layout.buildDirectory.file("libs/${mod.version}/$loader")) - dependsOn("build") -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 949bab3..6c84092 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,8 +7,8 @@ org.gradle.parallel=false #org.gradle.configureondemand=true # Mod properties -mod.version=2.0.0 -mod.group=io.github.jumperonjava +mod.version=1.0.0 +mod.group=com.example mod.id=template mod.name=Template diff --git a/omnisharp.json b/omnisharp.json deleted file mode 100644 index f8f2cc2..0000000 --- a/omnisharp.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "script": { - "enableScriptNuGetReferences": true, - "defaultTargetFramework": "net9.0" - } -} \ No newline at end of file