Engage/build.gradle

115 lines
4.0 KiB
Groovy
Raw Normal View History

2023-06-29 00:27:53 +00:00
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
2023-12-25 00:54:03 +00:00
id 'net.neoforged.gradle.userdev' version '7.0.72'
2023-06-29 00:27:53 +00:00
}
version = mod_version
group = mod_group_id
base {
archivesName = mod_id
}
2023-06-30 02:22:41 +00:00
// Include resources generated by data generators.
sourceSets {
data
2023-06-30 02:30:03 +00:00
main.resources { srcDirs += data.resources.srcDirs }
2023-06-30 02:22:41 +00:00
}
2023-12-25 00:54:03 +00:00
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
2023-06-29 00:27:53 +00:00
2023-12-25 00:54:03 +00:00
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
2023-06-29 00:27:53 +00:00
2023-12-25 00:54:03 +00:00
runs {
// applies to all the run configs below
configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
2023-06-29 00:27:53 +00:00
2023-12-25 00:54:03 +00:00
systemProperty 'forge.logging.console.level', 'debug'
2023-06-29 00:27:53 +00:00
2023-12-25 00:54:03 +00:00
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
2023-06-29 00:27:53 +00:00
}
2023-12-25 00:54:03 +00:00
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]
}
2023-06-30 02:22:41 +00:00
}
configurations {
dataImplementation.extendsFrom implementation
2023-06-29 00:27:53 +00:00
}
2023-12-25 00:54:03 +00:00
2023-06-29 00:27:53 +00:00
dependencies {
// Specify the version of Minecraft to use.
2023-12-25 00:54:03 +00:00
// 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}"
2023-06-29 00:27:53 +00:00
2023-06-30 02:22:41 +00:00
dataImplementation sourceSets.main.output
2023-06-29 00:27:53 +00:00
2023-12-25 00:54:03 +00:00
}
tasks.withType(ProcessResources).configureEach {
2023-06-29 00:27:53 +00:00
var replaceProperties = [
2023-12-25 00:54:03 +00:00
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
neo_version : neo_version, neo_version_range: neo_version_range,
2023-06-29 00:27:53 +00:00
loader_version_range: loader_version_range,
2023-12-25 00:54:03 +00:00
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,
2023-06-29 00:27:53 +00:00
]
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) {
2023-12-25 00:54:03 +00:00
from components.java
2023-06-29 00:27:53 +00:00
}
}
repositories {
maven {
2023-12-25 00:54:03 +00:00
url "file://${project.projectDir}/repo"
2023-08-29 22:50:19 +00:00
}
2023-06-29 00:27:53 +00:00
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
2023-12-25 00:54:03 +00:00
final var actualDateTime = OffsetDateTime.now(ZoneOffset.UTC).withNano(0)