From f0994fff759fa0e1fc156f1c061b5c608f27ec73 Mon Sep 17 00:00:00 2001 From: coolGi2007 Date: Sat, 12 Feb 2022 19:34:54 +1030 Subject: [PATCH] Added a way to add mods in code and not run on runtime and moved issues and source to gradle.properties --- build.gradle | 4 +++- fabric/build.gradle | 16 +++++++++----- fabric/src/main/resources/fabric.mod.json | 4 ++-- forge/build.gradle | 11 ++++++++-- forge/src/main/resources/META-INF/mods.toml | 2 +- gradle.properties | 24 ++++++++++++++++++--- 6 files changed, 47 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 4785592aa..f1471f118 100644 --- a/build.gradle +++ b/build.gradle @@ -108,7 +108,9 @@ allprojects { p -> mod_name: mod_name, authors: mod_authors, description: mod_description, - homepage: mod_homepage + homepage: mod_homepage, + source: mod_source, + issues: mod_issues ] // The left side is what gets replaced in the mod info and the right side is where to get it from in the gradle.properties inputs.properties replaceProperties diff --git a/fabric/build.gradle b/fabric/build.gradle index d336d5d0a..6a1f7556b 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -24,6 +24,12 @@ repositories { maven { url "https://maven.terraformersmc.com/" } } +def addMod(path, enabled) { + if (enabled == "2") + dependencies { modImplementation(path) } + else if (enabled == "1") + dependencies { modCompileOnly(path) } +} dependencies { // Fabric loader @@ -38,20 +44,20 @@ dependencies { } // Starlight - // modImplementation "curse.maven:starlight-521783:${rootProject.starlight_version_fabric}" + addMod("curse.maven:starlight-521783:${rootProject.starlight_version_fabric}", rootProject.enable_starlight) // Sodium - modImplementation "curse.maven:sodium-394468:${rootProject.sodium_version}" + addMod("curse.maven:sodium-394468:${rootProject.sodium_version}", rootProject.enable_sodium) implementation "org.joml:joml:1.10.2" // Lithium -// modImplementation "maven.modrinth:lithium:${rootProject.lithium_version}" + addMod("maven.modrinth:lithium:${rootProject.lithium_version}", rootProject.enable_lithium) // Iris -// modImplementation "maven.modrinth:iris:${rootProject.iris_version}" + addMod("maven.modrinth:iris:${rootProject.iris_version}", rootProject.enable_iris) // BCLib -// modImplementation "com.github.paulevsGitch:BCLib:${rootProject.bclib_version}" + modImplementation "com.github.paulevsGitch:BCLib:${rootProject.bclib_version}" // Immersive Portals /* diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index f32fdcb73..800cfbc9a 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -9,8 +9,8 @@ "contact": { "homepage": "${homepage}", - "sources": "https://gitlab.com/jeseibel/minecraft-lod-mod/", - "issues": "https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues" + "sources": "${source}", + "issues": "${issues}" }, "license": "CC0-1.0", diff --git a/forge/build.gradle b/forge/build.gradle index 86511a89b..95cc107da 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -25,13 +25,20 @@ configurations { developmentForge.extendsFrom common } +def addMod(path, enabled) { + if (enabled == "2") + dependencies { modImplementation(path) } + else if (enabled == "1") + dependencies { modCompileOnly(path) } +} + dependencies { // Forge loader forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" // Starlight -// modImplementation("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}") -// annotationProcessor "org.spongepowered:mixin:0.8.4:processor" + addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge) + annotationProcessor "org.spongepowered:mixin:0.8.4:processor" common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowMe(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } diff --git a/forge/src/main/resources/META-INF/mods.toml b/forge/src/main/resources/META-INF/mods.toml index 65a8b9e1f..38d065a59 100644 --- a/forge/src/main/resources/META-INF/mods.toml +++ b/forge/src/main/resources/META-INF/mods.toml @@ -2,7 +2,7 @@ modLoader="javafml" #//mandatory loaderVersion="[37,40)" # // mandatory. This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. license="GNU GPLv3" -issueTrackerURL="https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues" +issueTrackerURL="${issues}" [[mods]] #//mandatory diff --git a/gradle.properties b/gradle.properties index 42327827f..78826169e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,20 +12,38 @@ mod_name=Distant Horizons mod_description=This mod generates and renders simplified terrain beyond the normal view distance at a low performance cost. Allowing you to see much farther without turning your game into a slideshow. mod_authors=James Seibel, Leonardo Amato, Cola, coolGi2007, Ran, Leetom mod_homepage=https://www.curseforge.com/minecraft/mc-mods/distant-horizons +mod_source=https://gitlab.com/jeseibel/minecraft-lod-mod/ +mod_issues=https://gitlab.com/jeseibel/minecraft-lod-mod/-/issues # Fabric loader fabric_loader_version=0.13.1 fabric_api_version=0.46.4+1.18 - # Fabric mods + # Fabric mod versions modmenu_version=3.0.0 starlight_version_fabric=3554912 lithium_version=mc1.18.1-0.7.7 sodium_version=3605309 iris_version=1.18.x-v1.1.4 + bclib_version=1.2.5 immersive_portals_version = v1.0.4-1.18 - bclib_version=1.2.5 + + # Fabric mod run + # 0 = Dont enable and dont run + # 1 = Can be refranced in code but dosnt run + # 2 = Can be refranced in code and runs in client + enable_starlight=0 + enable_sodium=1 + enable_lithium=0 + enable_iris=0 + enable_bclib=0 # Forge loader forge_version=39.0.44 - # Forge mods + # Forge mod versions starlight_version_forge=3559934 + + # Forge mod run + # 0 = Dont enable and dont run + # 1 = Can be refranced in code but dosnt run + # 2 = Can be refranced in code and runs in client + enable_starlight_forge=0