115 lines
4.0 KiB
Groovy
115 lines
4.0 KiB
Groovy
plugins {
|
|
id 'eclipse'
|
|
id 'idea'
|
|
id 'maven-publish'
|
|
id 'net.neoforged.gradle.userdev' version '7.0.72'
|
|
}
|
|
|
|
version = mod_version
|
|
group = mod_group_id
|
|
|
|
base {
|
|
archivesName = mod_id
|
|
}
|
|
|
|
// Include resources generated by data generators.
|
|
sourceSets {
|
|
data
|
|
main.resources { srcDirs += data.resources.srcDirs }
|
|
}
|
|
|
|
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
|
|
|
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
|
|
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
|
|
|
|
runs {
|
|
// applies to all the run configs below
|
|
configureEach {
|
|
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
|
|
|
systemProperty 'forge.logging.console.level', 'debug'
|
|
|
|
modSource project.sourceSets.main
|
|
}
|
|
|
|
client {
|
|
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
|
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
|
}
|
|
|
|
server {
|
|
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
|
programArgument '--nogui'
|
|
}
|
|
|
|
gameTestServer {
|
|
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
|
}
|
|
|
|
data {
|
|
// example of overriding the workingDirectory set in configureEach above
|
|
workingDirectory project.file('run-data')
|
|
|
|
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
|
programArguments '--mod', 'engage', '--all'
|
|
programArguments '--output', sourceSets.data.resources.srcDirs[0].toString()
|
|
programArguments '--existing', sourceSets.main.resources.srcDirs[0].toString()
|
|
|
|
modSources = [sourceSets.main, sourceSets.data]
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
dataImplementation.extendsFrom implementation
|
|
}
|
|
|
|
|
|
dependencies {
|
|
// Specify the version of Minecraft to use.
|
|
// Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above.
|
|
// The group for userdev is net.neoforged, the module name is neoforge, and the version is the same as the neoforge version.
|
|
// You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader.
|
|
// And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version.
|
|
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
|
|
implementation "net.neoforged:neoforge:${neo_version}"
|
|
|
|
dataImplementation sourceSets.main.output
|
|
|
|
}
|
|
tasks.withType(ProcessResources).configureEach {
|
|
var replaceProperties = [
|
|
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
|
|
neo_version : neo_version, neo_version_range: neo_version_range,
|
|
loader_version_range: loader_version_range,
|
|
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
|
mod_authors : mod_authors, mod_description: mod_description, pack_format_number: pack_format_number,
|
|
]
|
|
inputs.properties replaceProperties
|
|
|
|
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
|
expand replaceProperties + [project: project]
|
|
}
|
|
}
|
|
|
|
// Example configuration to allow publishing using the maven-publish plugin
|
|
publishing {
|
|
publications {
|
|
register('mavenJava', MavenPublication) {
|
|
from components.java
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
url "file://${project.projectDir}/repo"
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
|
}
|
|
|
|
final var actualDateTime = OffsetDateTime.now(ZoneOffset.UTC).withNano(0)
|