-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba919c7
commit 4ae158d
Showing
26 changed files
with
303 additions
and
240 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
import groovy.json.JsonOutput | ||
import groovy.json.JsonSlurper | ||
|
||
plugins { | ||
id("net.neoforged.moddev") version "2.0.1-beta" | ||
} | ||
|
||
|
||
// Toolchain versions | ||
val minecraftVersion: String = "1.21" | ||
val neoForgeVersion: String = "21.0.167" | ||
val parchmentVersion: String = "2024.07.07" | ||
val parchmentMinecraftVersion: String = "1.21" | ||
|
||
val modId: String = "betterfoliage" | ||
val modVersion: String = System.getenv("VERSION") ?: "0.0.0-indev" | ||
val modJavaVersion: String = "21" | ||
val modIsInCI: Boolean = !modVersion.contains("-indev") | ||
|
||
|
||
val generateModMetadata = tasks.register<ProcessResources>("generateModMetadata") { | ||
val modReplacementProperties = mapOf( | ||
"modId" to modId, | ||
"modVersion" to modVersion, | ||
"minecraftVersionRange" to "[$minecraftVersion,)", | ||
"neoForgeVersionRange" to "[$neoForgeVersion,)" | ||
) | ||
inputs.properties(modReplacementProperties) | ||
expand(modReplacementProperties) | ||
from("src/main/templates") | ||
into(layout.buildDirectory.dir("generated/sources/modMetadata")) | ||
} | ||
|
||
|
||
base { | ||
archivesName.set("BetterFoliageRenewed-NeoForge-$minecraftVersion") | ||
group = "com.eerussianguy.betterfoliage" | ||
version = modVersion | ||
} | ||
|
||
java { | ||
toolchain.languageVersion.set(JavaLanguageVersion.of(modJavaVersion)) | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
exclusiveContent { | ||
forRepository { maven("https://www.cursemaven.com") } | ||
filter { includeGroup("curse.maven") } | ||
} | ||
} | ||
|
||
sourceSets { | ||
main { | ||
resources { | ||
srcDir(generateModMetadata) | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
} | ||
|
||
neoForge { | ||
version.set(neoForgeVersion) | ||
validateAccessTransformers = true | ||
|
||
parchment { | ||
minecraftVersion.set(parchmentMinecraftVersion) | ||
mappingsVersion.set(parchmentVersion) | ||
} | ||
|
||
runs { | ||
configureEach { | ||
// Only JBR allows enhanced class redefinition, so ignore the option for any other JDKs | ||
jvmArguments.addAll("-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition", "-ea") | ||
systemProperty("betterfoliage.enableDebugSelfTests", "true") | ||
} | ||
register("client") { | ||
client() | ||
gameDirectory = file("run/client") | ||
} | ||
} | ||
|
||
mods { | ||
create(modId) { | ||
sourceSet(sourceSets.main.get()) | ||
} | ||
} | ||
|
||
ideSyncTask(generateModMetadata) | ||
} | ||
|
||
tasks { | ||
processResources { | ||
if (modIsInCI) { | ||
doLast { | ||
val jsonMinifyStart: Long = System.currentTimeMillis() | ||
var jsonMinified: Long = 0 | ||
var jsonBytesBefore: Long = 0 | ||
var jsonBytesAfter: Long = 0 | ||
|
||
fileTree(mapOf("dir" to outputs.files.asPath, "include" to "**/*.json")).forEach { | ||
jsonMinified++ | ||
jsonBytesBefore += it.length() | ||
try { | ||
it.writeText(JsonOutput.toJson(JsonSlurper().parse(it)).replace("\"__comment__\":\"This file was automatically created by mcresources\",", "")) | ||
} catch (e: Exception) { | ||
println("JSON Error in ${it.path}") | ||
throw e | ||
} | ||
|
||
jsonBytesAfter += it.length() | ||
} | ||
println("Minified $jsonMinified json files. Reduced ${jsonBytesBefore / 1024} kB to ${(jsonBytesAfter / 1024)} kB. Took ${System.currentTimeMillis() - jsonMinifyStart} ms") | ||
} | ||
} | ||
} | ||
|
||
|
||
jar { | ||
manifest { | ||
attributes["Implementation-Version"] = project.version | ||
} | ||
} | ||
|
||
named("neoForgeIdeSync") { | ||
dependsOn(generateModMetadata) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties. | ||
# This is required to provide enough memory for the Minecraft decompilation process. | ||
org.gradle.jvmargs=-Xmx4G | ||
org.gradle.daemon=false | ||
org.gradle.console=plain | ||
org.gradle.jvmargs=-Xmx2G | ||
org.gradle.daemon=true | ||
org.gradle.parallel=true | ||
org.gradle.caching=true | ||
org.gradle.configuration-cache=true |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.