buildscript { repositories { maven { url = 'https://maven.minecraftforge.net' } maven { url = 'https://maven.parchmentmc.org' } jcenter() mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath 'org.parchmentmc:librarian:1.+' } } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: 'org.parchmentmc.librarian.forgegradle' apply from: 'https://raw.githubusercontent.com/MinecraftModDevelopment/Gradle-Collection/22e7d543a18cd30675277fbfa3669e3d9e206010/generic/secrets.gradle' apply from: 'https://raw.githubusercontent.com/SizableShrimp/Forge-Class-Remapper/main/classremapper.gradle' //import net.minecraftforge.gradle.common.task.SignJar import groovy.json.JsonSlurper import groovy.json.JsonOutput if (project.hasProperty('secretFile')) { loadSecrets(new File((String) findProperty('secretFile'))) } version = "${version}" group = "tschipp.carryon" archivesBaseName = "carryon-${minecraft_version}" //sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.16' if (System.getenv('BUILD_NUMBER') != null) { version += "." + System.getenv('BUILD_NUMBER') } java.toolchain.languageVersion = JavaLanguageVersion.of(16) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { mappings channel: 'parchment', version: '2021.12.12-1.17.1' runs { client { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" mods { carryon { source sourceSets.main } } } server { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" mods { carryon { source sourceSets.main } } } data { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' args '--mod', 'carryon', '--all', '--output', file('src/generated/resources/') mods { carryon { source sourceSets.main } } } } } repositories { maven { url "https://maven.blamejared.com/" } maven { url "https://maven.mcmoddev.com/" } flatDir { dirs 'libs' } maven { url "https://www.cursemaven.com" } } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" //implementation fg.deobf("net.darkhax.gamestages:GameStages-1.16.4:6.0.1") //implementation fg.deobf("net.darkhax.bookshelf:Bookshelf-1.16.4:9.3.18") //implementation fg.deobf("curse.maven:obfuscate-289380:3169370") //fileTree("libs").matching { // include "*.jar" //}.each { // String filename = it.getName(); // filename = filename.substring(0, filename.length() - 4); // int lastDash = filename.lastIndexOf("-"); // filename = filename.substring(0, lastDash) + ":" + filename.substring(lastDash+1, filename.length()); // implementation fg.deobf("blank:${filename}") //} } // Example for how to get properties into the manifest for reading by the runtime.. jar { manifest { attributes([ "Specification-Title": "carryon", "Specification-Vendor": "Carry On", "Specification-Version": "1", // We are version 1 of ourselves "Implementation-Title": project.name, "Implementation-Version": "${version}", "Implementation-Vendor" :"Carry On", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } jar.finalizedBy('reobfJar') task sourcesJar(type: Jar, dependsOn: classes) { description = 'Creates a JAR containing the source code.' from sourceSets.main.allSource classifier = 'sources' } task javadocJar(type: Jar, dependsOn: javadoc) { description = 'Creates a JAR containing the JavaDocs.' from javadoc.destinationDir classifier = 'javadoc' } task deobfJar(type: Jar) { description = 'Creates a JAR containing the non-obfuscated compiled code.' from sourceSets.main.output classifier = "deobf" } artifacts { archives sourcesJar archives javadocJar archives deobfJar } publishing { publications { mavenJava(MavenPublication) { groupId project.group artifactId project.archivesBaseName version project.version from components.java // Allows the maven pom file to be modified. pom.withXml { // Go through all the dependencies. asNode().dependencies.dependency.each { dep -> println 'Surpressing artifact ' + dep.artifactId.last().value().last() + ' from maven dependencies.' assert dep.parent().remove(dep) } } artifact sourcesJar { classifier 'sources' } artifact javadocJar { classifier 'javadoc' } artifact deobfJar { classifier 'deobf' } } } repositories { maven { url "file://" + System.getenv("local_maven") } } } //task signJar(type: SignJar, dependsOn: jar) { // Skips if the keyStore property is missing. // onlyIf { // project.hasProperty('modkeyStore') // } // findProperty allows us to reference the property without it existing. // Using project.propName would cause the script to fail validation if // the property did not exist. // keyStore = project.findProperty('modkeyStore') // alias = project.findProperty('modkeyStoreAlias') // storePass = project.findProperty('modkeyStorePass') // keyPass = project.findProperty('modkeyStoreKeyPass') // inputFile = jar.archivePath // outputFile = jar.archivePath //} // Runs this task automatically when build is ran. //build.dependsOn signJar