125 lines
4.6 KiB
Kotlin
125 lines
4.6 KiB
Kotlin
plugins {
|
|
`multiloader-loader`
|
|
id ("net.neoforged.gradle.userdev") version "7.1.4"
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven("https://maven.architectury.dev/")
|
|
maven("https://maven.terraformersmc.com/releases/")
|
|
maven("https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/")
|
|
maven("https://maven.blamejared.com/")
|
|
}
|
|
|
|
println(
|
|
"Java: ${providers.systemProperty("java.version").get()}, " +
|
|
"JVM: ${providers.systemProperty("java.vm.version").get()} (${
|
|
providers.systemProperty("java.vendor").get()
|
|
}), " +
|
|
"Arch: ${providers.systemProperty("os.arch").get()}"
|
|
)
|
|
|
|
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
|
|
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
|
|
|
|
// Default run configurations.
|
|
// These can be tweaked, removed, or duplicated as needed.
|
|
runs {
|
|
// applies to all the run configs below
|
|
configureEach {
|
|
// Recommended logging data for a userdev environment
|
|
// The markers can be added/remove as needed separated by commas.
|
|
// "SCAN": For mods scan.
|
|
// "REGISTRIES": For firing of registry events.
|
|
// "REGISTRYDUMP": For getting the contents of all registries.
|
|
systemProperty("forge.logging.markers", "REGISTRIES")
|
|
|
|
// Recommended logging level for the console
|
|
// You can set various levels here.
|
|
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
|
systemProperty("forge.logging.console.level", "debug")
|
|
|
|
modSource(project.sourceSets.main.get())
|
|
}
|
|
|
|
register("client") {
|
|
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
|
systemProperty("neoforge.enabledGameTestNamespaces", commonMod.id)
|
|
}
|
|
|
|
register("server") {
|
|
systemProperty("neoforge.enabledGameTestNamespaces", commonMod.id)
|
|
argument("--nogui")
|
|
}
|
|
|
|
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
|
// By default, the server will crash when no gametests are provided.
|
|
// The gametest system is also enabled by default for other run configs under the /test command.
|
|
register("gameTestServer") {
|
|
systemProperty("neoforge.enabledGameTestNamespaces", commonMod.id)
|
|
}
|
|
|
|
register("data") {
|
|
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
|
// workingDirectory project.file('run-data')
|
|
|
|
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
|
arguments.addAll("--mod", commonMod.id, "--all", "--output", file("src/generated/resources/").getAbsolutePath(), "--existing", file("src/main/resources/").getAbsolutePath())
|
|
}
|
|
}
|
|
|
|
// Include resources generated by data generators.
|
|
sourceSets.main { resources.srcDir("src/generated/resources") }
|
|
|
|
// Sets up a dependency configuration called 'localRuntime'.
|
|
// This configuration should be used instead of 'runtimeOnly' to declare
|
|
// a dependency that will be present for runtime testing but that is
|
|
// "optional", meaning it will not be pulled by dependents of this mod.
|
|
//configurations {
|
|
// runtimeClasspath.extendsFrom(localRuntime)
|
|
//}
|
|
|
|
dependencies {
|
|
implementation("net.neoforged:neoforge:${commonMod.prop("neoforge_version")}")
|
|
|
|
// Architectury & GeckoLib
|
|
implementation("dev.architectury:architectury-neoforge:${commonMod.prop("architectury_version")}")
|
|
implementation("software.bernie.geckolib:geckolib-neoforge-${commonMod.minecraft_version}:${commonMod.prop("geckolib_version")}")
|
|
|
|
// JEI (NeoForge)
|
|
compileOnly("mezz.jei:jei-${commonMod.minecraft_version}-common-api:${commonMod.prop("jei_version")}")
|
|
compileOnly("mezz.jei:jei-${commonMod.minecraft_version}-neoforge-api:${commonMod.prop("jei_version")}")
|
|
runtimeOnly("mezz.jei:jei-${commonMod.minecraft_version}-neoforge:${commonMod.prop("jei_version")}")
|
|
}
|
|
|
|
|
|
tasks.withType(JavaCompile::class).configureEach {
|
|
options.encoding = "UTF-8" // Use the UTF-8 charset for Java compilation
|
|
}
|
|
|
|
tasks {
|
|
processResources {
|
|
exclude("${mod.id}.accesswidener")
|
|
}
|
|
|
|
register<Copy>("copyAT") {
|
|
val atFile =
|
|
project(":common").file("src/main/resources/accesstransformers/accesstransformer-${commonMod.minecraft_version}.cfg")
|
|
from(atFile) {
|
|
rename("accesstransformer-${commonMod.minecraft_version}.cfg", "accesstransformer.cfg")
|
|
}
|
|
setDuplicatesStrategy(DuplicatesStrategy.INHERIT)
|
|
into("src/main/resources/META-INF")
|
|
mustRunAfter(common.project.tasks.getByName("stonecutterMerge"))
|
|
}
|
|
}
|
|
|
|
tasks.named("stonecutterPrepare") {
|
|
finalizedBy(tasks.named("copyAT"))
|
|
}
|
|
|
|
sourceSets.forEach {
|
|
val dir = layout.buildDirectory.dir("sourcesSets/$it.name")
|
|
it.output.setResourcesDir(dir)
|
|
it.java.destinationDirectory = dir
|
|
} |