123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- plugins {
- id 'java-library'
- id 'eclipse'
- id 'idea'
- id 'maven-publish'
- id 'net.neoforged.gradle.userdev' version '7.0.+'
- }
- def secrets = new Properties()
- def secretsFile = file('secrets.properties')
- if (secretsFile.exists()) {
- secretsFile.withInputStream {
- stream -> secrets.load(stream)
- }
- fileTree("secrets").matching {
- include "**/*.properties"
- }.each {
- File file ->
- file.withInputStream {
- stream -> secrets.load(stream)
- }
- }
- }
- version = (hasProperty("CIRevision") ? CIRevision : project.mod_version)
- group = group_name
- base {
- archivesName = "${project.mod_id}-${project.minecraft_version}"
- }
- java.toolchain.languageVersion = JavaLanguageVersion.of(17)
- minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
- compileJava.options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation" << "-Werror"
- runs {
- configureEach {
- workingDirectory project.file('run')
- systemProperty 'forge.logging.console.level', 'debug'
- systemProperty 'fml.earlyprogresswindow', 'false'
- systemProperty 'mixin.env.disableRefMap', 'true'
- modSource project.sourceSets.main
- }
- client {
- // name "Minecraft_Client_${project.minecraft_version}"
- systemProperty 'forge.enabledGameTestNamespaces', mod_id
- programArguments.addAll '--username', secrets.getProperty("username")?: 'Dev', secrets.getProperty("uuid") ? '--uuid' : '', secrets.getProperty("uuid")?: ''
- }
- server {
- // name "Minecraft_Server_${project.minecraft_version}"
- systemProperty 'forge.enabledGameTestNamespaces', mod_id
- programArgument '--nogui'
- }
- gameTestServer {
- // name "Minecraft_GameTestServer_${project.minecraft_version}"
- systemProperty 'forge.enabledGameTestNamespaces', mod_id
- }
- data {
- // name "Minecraft_Data_${project.minecraft_version}"
- workingDirectory project.file('run-data')
- programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
- }
- }
- subsystems {
- parchment {
- minecraftVersion = "1.20.3" //parchment doesnt support 1.20.4 yet????
- mappingsVersion = project.parchment_version
- }
- }
- sourceSets.main.resources { srcDir 'src/generated/resources' }
- repositories {
- maven {
- name 'Jared\'s Maven' // JEI
- url 'https://maven.blamejared.com/'
- }
- maven {
- name 'tterrag\'s Maven' // CTM
- url 'https://maven.tterrag.com/'
- }
- maven {
- name 'theillusivec4\'s Maven' // Curios
- url 'https://maven.theillusivec4.top/'
- }
- maven {
- name 'Tama\'s Maven' // Cross-Dim Commands
- url "https://maven.tamaized.com/releases"
- }
- maven {
- name 'Shedaniel\'s Maven' //REI
- url "https://maven.shedaniel.me"
- }
- maven {
- name = "TerraformersMC" //EMI
- url = "https://maven.terraformersmc.com/"
- }
- maven {
- name 'Curseforge Maven' // Jade
- url "https://www.cursemaven.com"
- content {
- includeGroup "curse.maven"
- }
- }
- }
- dependencies {
- //make sure to only pick one of these when testing (switch others to compileOnly)
- implementation "mezz.jei:jei-${project.minecraft_version}-neoforge:${project.jei_version}"
- compileOnly "me.shedaniel:RoughlyEnoughItems-neoforge:${project.rei_version}"
- compileOnly "dev.emi:emi-neoforge:${project.emi_version}+${project.minecraft_version}"
- // theillusivec4
- implementation "top.theillusivec4.curios:curios-neoforge:${project.curios_version}+${project.minecraft_version}"
- //curse maven
- compileOnly "curse.maven:jade-324717:4980188"
- //runtimeOnly "curse.maven:jeed-532286:4599236"
- //runtimeOnly "curse.maven:museum-curator-859070:4629894"
- compileOnly"curse.maven:the-one-probe-245211:5084077"
- //mods we dont have compat with but are nice to have
- //runtimeOnly "team-twilight:crossdimcommands:${project.base_minecraft_version}-1.0"
- //minecraft
- implementation "net.neoforged:neoforge:${project.neo_version}"
- }
- tasks.named('jar', Jar).configure {
- manifest {
- archiveClassifier = 'universal'
- attributes([
- 'Specification-Title' : mod_id,
- 'Specification-Vendor' : "TeamTwilight",
- 'Specification-Version' : "1",
- 'Implementation-Title' : project.name,
- 'Implementation-Version' : project.jar.archiveVersion,
- 'Implementation-Vendor' : "TeamTwilight",
- 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
- ])
- }
- }
- publishing {
- publications {
- mavenJava(MavenPublication) {
- afterEvaluate {
- artifact project.jar
- artifact project.sourceJar
- }
- setGroupId 'teamtwilight'
- setArtifactId project.mod_id
- }
- }
- repositories {
- maven {
- //url "file:///${project.projectDir}/mcmodsrepo"
- url "https://modmaven.dev:443/artifactory/local-releases"
- credentials {
- username System.getenv('ARTIFACTORY_USER')
- password System.getenv('ARTIFACTORY_PASS')
- }
- }
- }
- }
- tasks.register('sourceJar', Jar) {
- dependsOn 'classes'
- from sourceSets.main.allSource
- archiveClassifier = 'sources'
- }
- tasks.withType(JavaCompile).configureEach {
- options.encoding = 'UTF-8'
- }
- idea {
- // Tell IDEA to always download sources/javadoc artifacts from maven.
- module {
- downloadJavadoc = true
- downloadSources = true
- }
- }
|