@@ -26,7 +26,7 @@ sourceCompatibility = JavaVersion.VERSION_21
2626targetCompatibility = JavaVersion . VERSION_21
2727
2828archivesBaseName = project. archives_base_name
29- version = " ${ project.mod_version }${ getVersionType(project.version_type, project.revision) } +mc ${ project.minecraft_version } - ${ getVersionMetadata() } "
29+ version = createVersionString()
3030group = project. maven_group
3131
3232loom {
@@ -58,7 +58,7 @@ dependencies {
5858 mappings " net.fabricmc:yarn:${ project.yarn_mappings} :v2"
5959 modImplementation " net.fabricmc:fabric-loader:${ project.loader_version} "
6060
61- // modImplementation "me.jellysquid.mods:sodium-fabric :0.5.6+git.d2b4c1f "
61+ // modImplementation "me.jellysquid.mods:sodium:0.5.9-snapshot+mc1.21-pre3-build.9 "
6262 modImplementation " maven.modrinth:sodium:${ project.sodium_version} "
6363 /* modImplementation("me.flashyreese.mods:reeses-sodium-options:${project.reeses_sodium_options}") {
6464 exclude group: "net.coderbot.iris_mc1_19", module: "iris"
@@ -131,22 +131,28 @@ publishing {
131131 }
132132}
133133
134- static def getVersionMetadata () {
135- def build_id = System . getenv( " GITHUB_RUN_NUMBER " )
134+ def createVersionString () {
135+ def builder = new StringBuilder ( )
136136
137- // CI builds only
138- if (build_id != null ) {
139- return " build.${ build_id} "
137+ def isReleaseBuild = project. hasProperty(" build.release" )
138+ def buildId = System . getenv(" GITHUB_RUN_NUMBER" )
139+
140+ if (isReleaseBuild) {
141+ builder. append(mod_version)
142+ } else {
143+ builder. append(mod_version. split(' -' )[0 ])
144+ builder. append(" -snapshot" )
140145 }
141- // No tracking information could be found about the build
142- return " unknown"
143- }
144146
145- static def getVersionType (String version_type , String revision ) {
146- version_type = version_type. trim(). toLowerCase()
147- revision = revision. trim(). toLowerCase()
148- if (version_type != " release" ) {
149- return " -${ version_type}${ revision} "
147+ builder. append(" +mc" ). append(minecraft_version)
148+
149+ if (! isReleaseBuild) {
150+ if (buildId != null ) {
151+ builder. append(" -build.${ buildId} " )
152+ } else {
153+ builder. append(" -local" )
154+ }
150155 }
151- return " "
152- }
156+
157+ return builder. toString()
158+ }
0 commit comments