Skip to content

Commit 9e328e6

Browse files
bloom hud optionalprop
1 parent 282d714 commit 9e328e6

2 files changed

Lines changed: 20 additions & 15 deletions

File tree

build.gradle.kts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
44
plugins {
55
id("net.fabricmc.fabric-loom-remap") version "1.14-SNAPSHOT"
66
id("org.jetbrains.kotlin.jvm") version "2.3.0"
7+
id("dev.deftu.gradle.bloom") version "0.2.0"
78
}
89

910
val modid = property("mod.id")
@@ -33,10 +34,15 @@ loom {
3334

3435
dependencies {
3536
minecraft("com.mojang:minecraft:${property("minecraft_version")}")
37+
@Suppress("UnstableApiUsage")
3638
mappings(loom.layered {
3739
officialMojangMappings()
38-
parchment("org.parchmentmc.data:parchment-${property("minecraft_version")}:${property("parchment_version")}@zip")
39-
mappings("dev.lambdaurora:yalmm-mojbackward:${property("minecraft_version")}+build.${property("yalmm_version")}")
40+
optionalProp("${property("parchment_version")}") {
41+
parchment("org.parchmentmc.data:parchment-${property("minecraft_version")}:$it@zip")
42+
}
43+
optionalProp("${property("yalmm_version")}") {
44+
mappings("dev.lambdaurora:yalmm-mojbackward:${property("minecraft_version")}+build.$it")
45+
}
4046
})
4147
modImplementation("net.fabricmc:fabric-loader:${property("loader_version")}")
4248
modImplementation("org.polyfrost.oneconfig:${property("minecraft_version")}-fabric:1.0.0-alpha.181")
@@ -47,17 +53,16 @@ dependencies {
4753
modImplementation("org.polyfrost.oneconfig:internal:1.0.0-alpha.181")
4854
modImplementation("org.polyfrost.oneconfig:ui:1.0.0-alpha.181")
4955
modImplementation("org.polyfrost.oneconfig:utils:1.0.0-alpha.181")
50-
51-
implementation("dev.deftu:Bloom:0.1.2")
56+
modImplementation("org.polyfrost.oneconfig:hud:1.0.0-alpha.181")
5257

5358
modImplementation("net.fabricmc:fabric-language-kotlin:${property("fabric_kotlin_version")}")
5459
}
5560

56-
//bloom {
57-
// replacement("@MOD_ID@", modid)
58-
// replacement("@MOD_NAME@", modname)
59-
// replacement("@MOD_VERSION@", modversion)
60-
//}
61+
bloom {
62+
replacement("@MOD_ID@", modid!!)
63+
replacement("@MOD_NAME@", modname!!)
64+
replacement("@MOD_VERSION@", modversion!!)
65+
}
6166

6267
tasks.processResources {
6368
val props = mapOf(
@@ -96,3 +101,6 @@ tasks.jar {
96101
rename { "${it}_${inputs.properties["archivesName"]}" }
97102
}
98103
}
104+
105+
fun <T> optionalProp(property: String, block: (String) -> T?): T? =
106+
findProperty(property)?.toString()?.takeUnless { it.isBlank() }?.let(block)

src/main/kotlin/org/polyfrost/polysprint/PolySprintConstants.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ package org.polyfrost.polysprint
2020

2121
object PolySprintConstants {
2222
// Sets the variables from `gradle.properties`. Depends on the `bloom` DGT plugin.
23-
// const val ID: String = "@MOD_ID@"
24-
// const val NAME: String = "@MOD_NAME@"
25-
// const val VERSION: String = "@MOD_VERSION@"
26-
const val ID: String = "polysprint"
27-
const val NAME: String = "PolySprint"
28-
const val VERSION: String = "1.1.0-alpha.1"
23+
const val ID: String = "@MOD_ID@"
24+
const val NAME: String = "@MOD_NAME@"
25+
const val VERSION: String = "@MOD_VERSION@"
2926
}

0 commit comments

Comments
 (0)