buildscript { repositories { maven { url = 'https://maven.minecraftforge.net' } mavenCentral() jcenter() maven { url = 'https://repo.spongepowered.org/repository/maven-public' } maven { url = 'https://maven.parchmentmc.org' } } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forgegradle_version}", changing: true classpath "org.spongepowered:mixingradle:${mixingradle_version}" classpath "org.parchmentmc:librarian:${librarian_version}" } } plugins { id 'com.github.johnrengelman.shadow' version "${shadow_version}" id 'com.matthewprenger.cursegradle' version "${cursegradle_version}" } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.parchmentmc.librarian.forgegradle' apply plugin: 'eclipse' apply plugin: 'maven-publish' apply plugin: 'org.spongepowered.mixin' boolean dev = System.getenv('RELEASE') == null || System.getenv('RELEASE').equals('false'); // jozu: I use a gradle workspace with both projects. // The project is named Flywheel-Forge, but sub-projects are named by folder. boolean flywheelInWorkspace = findProject(':Flywheel') != null boolean inMultiModWorkspace = rootProject.hasProperty('multiModWorkspace.enabled') boolean catnipInWorkspace = rootProject.hasProperty('multiModWorkspace.catnip') boolean ponderInWorkspace = rootProject.hasProperty('multiModWorkspace.ponder') if (catnipInWorkspace) { evaluationDependsOn(":catnip") } if (ponderInWorkspace) { evaluationDependsOn(":Ponder") } ext.buildNumber = System.getenv('BUILD_NUMBER') if (buildNumber == null) buildNumber = 'custom' version = "mc${minecraft_version}_v${mod_version}" + (dev && !buildNumber.equals('custom') ? "+${buildNumber}" : '') group = 'com.simibubi.create' archivesBaseName = 'create' java.toolchain.languageVersion = JavaLanguageVersion.of(17) 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: "${parchment_version}-${minecraft_version}" accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') runs { client { workingDirectory project.file('run') if (inMultiModWorkspace) ideaModule "createmod.Create.main" else ideaModule "Create.main" arg '-mixin.config=create.mixins.json' arg '-mixin.config=flywheel.mixins.json' if (catnipInWorkspace) { arg '-mixin.config=catnip.mixins.json' } //jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling property 'forge.logging.console.level', 'info' mods { create { source sourceSets.main } if (flywheelInWorkspace) { flywheel { source project(":Flywheel").sourceSets.main } } if (catnipInWorkspace) { catnip { source project(":catnip:Common").sourceSets.main source project(":catnip:Forge").sourceSets.main } } if (ponderInWorkspace) { ponder { source project(":Ponder:Common").sourceSets.main source project(":Ponder:Forge").sourceSets.main } } } } server { workingDirectory project.file('run/server') if (inMultiModWorkspace) ideaModule "createmod.Create.main" else ideaModule "Create.main" arg '-mixin.config=create.mixins.json' property 'forge.logging.console.level', 'info' mods { create { source sourceSets.main } if (catnipInWorkspace) { catnip { source project(":catnip:Common").sourceSets.main source project(":catnip:Forge").sourceSets.main } } if (ponderInWorkspace) { ponder { source project(":Ponder:Common").sourceSets.main source project(":Ponder:Forge").sourceSets.main } } } } data { workingDirectory project.file('run') if (inMultiModWorkspace) ideaModule "createmod.Create.main" else ideaModule "Create.main" property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' args '--mod', 'create', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources') mods { create { source sourceSets.main } if (flywheelInWorkspace) { flywheel { source project(":Flywheel").sourceSets.main } } if (ponderInWorkspace) { ponder { source project(":Ponder:Common").sourceSets.main source project(":Ponder:Forge").sourceSets.main } } } } } } compileJava { options.compilerArgs = ['-Xdiags:verbose'] } sourceSets.main.resources { srcDir 'src/generated/resources' } mixin { add sourceSets.main, 'create.refmap.json' } repositories { maven { // Location of the maven that hosts JEI files (and TiC) name 'Progwml6 maven' url 'https://dvs1.progwml6.com/files/maven' } /*maven { // Location of a maven mirror for JEI files, as a fallback name 'ModMaven' url 'https://modmaven.k-4u.nl' }*/ maven { // Location of the maven for vazkii's mods name 'blamejared' url 'https://maven.blamejared.com' } maven { // Location of the maven for mixed mappings, Registrate, and Flywheel name 'tterrag maven' url 'https://maven.tterrag.com' } maven { url 'https://www.cursemaven.com' content { includeGroup "curse.maven" } } maven { //location of the maven for dynamic trees url 'https://harleyoconnor.com/maven' } maven { //location of the maven for curios api url = "https://maven.theillusivec4.top/" } maven { // Location of the maven for Ponder, Catnip name 'createmod maven' url 'https://maven.createmod.net' } } configurations { shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" def registrate = "com.tterrag.registrate:Registrate:${registrate_version}" implementation fg.deobf(registrate) shade registrate if (flywheelInWorkspace) { implementation project(':Flywheel') } else { implementation fg.deobf("com.jozufozu.flywheel:Flywheel-Forge:${flywheel_version}") } if (catnipInWorkspace) { implementation project(":catnip:Common") implementation project(":catnip:Forge") } else { implementation fg.deobf("net.createmod.catnip:Catnip-Forge-${minecraft_version}:${catnip_version}") } if (ponderInWorkspace) { implementation project(":Ponder:Common") implementation project(":Ponder:Forge") } else { implementation fg.deobf("net.createmod.ponder:Ponder-Forge-${minecraft_version}:${ponder_version}") } compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api") runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}") compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}:api") runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}") // implementation fg.deobf("curse.maven:druidcraft-340991:3101903") // implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta25") // runtimeOnly fg.deobf("vazkii.arl:AutoRegLib:1.4-35.69") // runtimeOnly fg.deobf("vazkii.quark:Quark:r2.0-212.984") // runtimeOnly fg.deobf("slimeknights.mantle:Mantle:1.16.5-1.6.115") // runtimeOnly fg.deobf("slimeknights.tconstruct:TConstruct:1.16.5-3.1.1.252") // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings // This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly if (System.getProperty('idea.sync.active') != 'true') { annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor" } } jar { classifier = 'slim' manifest { attributes([ 'Specification-Title': 'create', 'Specification-Vendor': 'simibubi', 'Specification-Version': '1', 'Implementation-Title': project.name, 'Implementation-Version': "${version}", 'Implementation-Vendor': 'simibubi', 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), 'MixinConfigs': 'create.mixins.json' ]) } } shadowJar { classifier = '' configurations = [project.configurations.shade] relocate 'com.tterrag.registrate', 'com.simibubi.create.repack.registrate' } reobf { shadowJar {} } task sourcesJar(type: Jar) { from sourceSets.main.allSource archiveBaseName.set(project.archivesBaseName) archiveVersion.set("${project.version}") archiveClassifier.set('sources') } task javadocJar(type: Jar, dependsOn: javadoc) { from javadoc.destinationDir archiveClassifier.set('javadoc') } artifacts { archives jar, shadowJar, sourcesJar, javadocJar } publishing { tasks.publish.dependsOn 'build' publications { mavenJava(MavenPublication) { artifact shadowJar artifact sourcesJar artifact javadocJar } } repositories { if (project.hasProperty('mavendir')) { maven { url mavendir } } } } String getChangelogText() { def changelogFile = file('changelog.txt') String str = '' int lineCount = 0 boolean done = false changelogFile.eachLine { if (done || it == null) { return } if (it.size() > 1) { def temp = it if (lineCount == 0) { temp = "Create ${version}" temp = "Create v${mod_version}  for Minecraft ${minecraft_version}
" } else if (it.startsWith('-')) { temp = "   $temp
" temp = temp.replaceAll("(\\S+\\/\\S+)#([0-9]+)\\b", "\$0"); temp = temp.replaceAll("#([0-9]+)\\b(?!<\\/a>)", "\$0"); } else { temp = "

$temp

" } str += temp lineCount++ } else { str += "

Please submit any Issues you come across on the Issue Tracker.

" done = true } } return str } // changelog debugging // new File("changelog.html").write getChangelogText() // tasks.curseforge.enabled = !dev && project.hasProperty('simi_curseforge_key') // curseforge { // if (project.hasProperty('simi_curseforge_key')) { // apiKey = project.simi_curseforge_key // } // // project { // id = project.projectId // changelog = System.getenv('CHANGELOG') == null || System.getenv('CHANGELOG').equals('none') ? getChangelogText() : System.getenv('CHANGELOG') // changelogType = 'html' // releaseType = project.curse_type // mainArtifact(shadowJar) { // displayName = "Create - ${version}" // } // relations { // optionalDependency 'jei' // } // } // }