From 5df46a0fad92a14c23f98f2e0261df60917597f4 Mon Sep 17 00:00:00 2001 From: BitHeaven Date: Tue, 21 Jan 2025 16:49:39 +0500 Subject: [PATCH] IDK --- build.gradle | 82 ++++++++++++++++++++++----------------- gradle.properties | 29 +------------- gradle/libs.versions.toml | 46 ++++++++++++++++++++++ 3 files changed, 95 insertions(+), 62 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle b/build.gradle index 505cf3e..a04a5c2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,16 @@ plugins { - id "fabric-loom" version "1.8+" + alias libs.plugins.fabric.loom id "io.github.p03w.machete" version "1.+" // automatic jar compressing on build id 'maven-publish' } -base.archivesName = archives_base_name -group = project.maven_group +base { + archivesName = project.archives_base_name +} String buildNumber = System.getenv("RUN_NUMBER") -version = "${mod_version}+${minecraft_version}" + (buildNumber != null ? "-${buildNumber}" : "") +version = "${mod_version}+${libs.versions.minecraft.get()}" + (buildNumber != null ? "-${buildNumber}" : "") +group = project.maven_group repositories { // Add repositories to retrieve artifacts from in here. @@ -22,7 +24,10 @@ repositories { name = 'ParchmentMC' url = 'https://maven.parchmentmc.org' } - maven { url = "https://maven.quiltmc.org/repository/release" } // Quilt Mappings + maven { + name = 'Quilt' + url = 'https://maven.quiltmc.org/repository/release' + } maven { url = "https://api.modrinth.com/maven" } // LazyDFU maven { url = "https://maven.terraformersmc.com/releases/" } // Mod Menu maven { url = "https://cursemaven.com" } // Forge Config API Port @@ -49,54 +54,58 @@ repositories { } } +loom { + // Loom and Loader both use this block in order to gather more information about your mod. + mods { + // This should match your mod id. + "ru.bitheaven.createairfabric" { + // Tell Loom about each source set used by your mod here. This ensures that your mod's classes are properly transformed by Loader. + sourceSet("main") + // If you shade (directly include classes, not JiJ) a dependency into your mod, include it here using one of these methods: + // dependency("com.example.shadowedmod:1.2.3") + // configuration("exampleShadedConfigurationName") + } + } +} + +// All the dependencies are declared at gradle/libs.version.toml and referenced with "libs." dependencies { - // To change the versions see the gradle.properties file - minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings(loom.layered { - it.mappings("org.quiltmc:quilt-mappings:${minecraft_version}+build.${qm_version}:intermediary-v2") - it.parchment("org.parchmentmc.data:parchment-${minecraft_version}:${parchment_version}@zip") - it.officialMojangMappings { nameSyntheticMembers = false } - }) - modImplementation("net.fabricmc:fabric-loader:${fabric_loader_version}") + minecraft libs.minecraft + mappings loom.layered { + mappings "org.quiltmc:quilt-mappings:${libs.versions.quilt.mappings.get()}:intermediary-v2" + officialMojangMappings() + } + + modImplementation libs.fabric.loader // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation("net.fabricmc.fabric-api:fabric-api:${fabric_api_version}") + modImplementation libs.fabric.api // Create - dependencies are added transitively - modImplementation("com.simibubi.create:create-fabric-${minecraft_version}:${create_version}") + modImplementation libs.create // Thin Air - modImplementation("maven.modrinth:thin-air:${thinair_version}") + modImplementation libs.thinair // Ad Astra - modImplementation("maven.modrinth:ad-astra:${adastra_version}") - modImplementation("maven.modrinth:botarium:${botarium_version}") + modImplementation libs.adastra + modImplementation libs.botarium // Development QOL - modLocalRuntime("maven.modrinth:lazydfu:${lazydfu_version}") - modLocalRuntime("com.terraformersmc:modmenu:${modmenu_version}") + modLocalRuntime libs.lazydfu + modLocalRuntime libs.modmenu include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.4.1"))) - -// Recipe Viewers - Create Fabric supports JEI, REI, and EMI. - // See root gradle.properties to choose which to use at runtime. - switch (recipe_viewer.toLowerCase(Locale.ROOT)) { - case "jei": modLocalRuntime("mezz.jei:jei-$minecraft_version-fabric:$jei_version"); break - case "rei": modLocalRuntime("me.shedaniel:RoughlyEnoughItems-fabric:$rei_version"); break - case "emi": modLocalRuntime("dev.emi:emi-fabric:$emi_version"); break - case "disabled": break - default: println("Unknown recipe viewer specified: $recipe_viewer. Must be JEI, REI, EMI, or disabled.") - } } processResources { // require dependencies to be the version compiled against or newer Map properties = [ "version": version, - "fabric_loader_version": fabric_loader_version, - "fabric_api_version": fabric_api_version, - "create_version": create_version, - "minecraft_version": minecraft_version + "fabric_loader_version": libs.versions.fabric.loader.get(), + "fabric_api_version": libs.versions.fabric.api.get(), + "create_version": libs.versions.create.get(), + "minecraft_version": libs.versions.minecraft.get() ] inputs.properties(properties) @@ -112,11 +121,14 @@ tasks.withType(JavaCompile).configureEach { } java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + withSourcesJar() } jar { from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} + rename { "${it}_${base.archivesName.get()}"} } } diff --git a/gradle.properties b/gradle.properties index ee5e9e3..de0fff2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,36 +1,11 @@ # Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G +org.gradle.jvmargs = -Xmx2G -# Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.10 -fabric_loader_version=0.16.9 -# check this on https://modmuss50.me/fabric.html -fabric_api_version=0.92.2+1.20.1 -# Mappings -# https://lambdaurora.dev/tools/import_quilt.html -qm_version = 23 -# https://parchmentmc.org/docs/getting-started -parchment_version = 2023.09.03 # Mod Properties mod_version = 1.0 maven_group = ru.bitheaven archives_base_name = createairfabric -# Dependencies -# https://modrinth.com/mod/create-fabric/versions -create_version = 0.5.1-j-build.1631+mc1.20.1 -# https://modrinth.com/mod/thin-air/versions -thinair_version = v8.1.5-1.20.1-Fabric -# https://modrinth.com/mod/ad-astra/versions -adastra_version = Xtm1uo8F -botarium_version = f3ATcSfq -# set to disabled to have none of them. -recipe_viewer = disabled -# Mod Menu - https://modrinth.com/mod/modmenu/versions -modmenu_version = 7.2.2 -# LazyDFU - https://modrinth.com/mod/lazydfu/versions -lazydfu_version = 0.1.3 \ No newline at end of file +# Dependencies are managed at gradle/libs.versions.toml \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..23393f2 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,46 @@ +# The latest versions are available at https://quiltmc.org/en/usage/latest-versions +[versions] +minecraft = "1.20.1" +# https://lambdaurora.dev/tools/import_quilt.html +quilt_mappings = "1.20.1+build.23" +# https://parchmentmc.org/docs/getting-started +parchment = "2023.09.03" + +fabric_loom = "1.8+" +# check these on https://modmuss50.me/fabric.html +fabric_loader = "0.16.9" +fabric_api = "0.92.2+1.20.1" + +# https://modrinth.com/mod/create-fabric/versions +create = "0.5.1-j-build.1631+mc1.20.1" +# https://modrinth.com/mod/thin-air/versions +thinair = "v8.1.5-1.20.1-Fabric" +# https://modrinth.com/mod/ad-astra/versions +adastra = "Xtm1uo8F" +# https://modrinth.com/mod/botarium/versions +botarium = "f3ATcSfq" + +# LazyDFU - https://modrinth.com/mod/lazydfu/versions +lazydfu = "0.1.3" +# Mod Menu - https://modrinth.com/mod/modmenu/versions +modmenu = "7.2.2" + +[libraries] +minecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" } + +fabric_loader = { module = "net.fabricmc:fabric-loader", version.ref = "fabric_loader" } +fabric_api = { module = "net.fabricmc.fabric-api:fabric-api", version.ref = "fabric_api" } + +create = { module = "com.simibubi.create:create-fabric-1.20.1", version.ref = "create" } +thinair = { module = "maven.modrinth:thin-air", version.ref = "thinair" } +adastra = { module = "maven.modrinth:ad-astra", version.ref = "adastra" } +botarium = { module = "maven.modrinth:botarium", version.ref = "botarium" } + +lazydfu = { module = "maven.modrinth:lazydfu", version.ref = "lazydfu" } +modmenu = { module = "com.terraformersmc:modmenu", version.ref = "modmenu" } + +# If you have multiple similar dependencies, you can declare a dependency bundle and reference it on the build script with "libs.bundles.example". +[bundles] + +[plugins] +fabric_loom = { id = "fabric-loom", version.ref = "fabric_loom" } \ No newline at end of file