buildscript { repositories { // These repositories are only for Gradle plugins, put any other repositories in the repository block further below maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } mavenCentral() } dependencies { classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' } } plugins { id 'eclipse' id 'idea' id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' } apply plugin: 'org.spongepowered.mixin' group = mod_group_id version = mod_version base { archivesName = mod_id } java { toolchain.languageVersion = JavaLanguageVersion.of(17) } minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { // applies to all the run configs below configureEach { workingDirectory project.file('runs') // Recommended logging data for a userdev environment // The markers can be added/remove as needed separated by commas. // "SCAN": For mods scan. // "REGISTRIES": For firing of registry events. // "REGISTRYDUMP": For getting the contents of all registries. property 'forge.logging.markers', 'REGISTRIES' // Recommended logging level for the console // You can set various levels here. // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels property 'forge.logging.console.level', 'debug' mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id workingDirectory project.file('runs/client1') } server { property 'forge.enabledGameTestNamespaces', mod_id workingDirectory project.file('runs/server') args '--nogui' } // This run config launches GameTestServer and runs all registered gametests, then exits. // By default, the server will crash when no gametests are provided. // The gametest system is also enabled by default for other run configs under the /test command. gameTestServer { property 'forge.enabledGameTestNamespaces', 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. args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } mixin { add sourceSets.main, "${mod_id}.refmap.json" config "${mod_id}.mixins.json" } // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dir 'libs' } maven { url "https://cursemaven.com" } maven { name = "Modrinth" url = "https://api.modrinth.com/maven" } mavenCentral() } dependencies { compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:0.5.0")) implementation(jarJar("io.github.llamalad7:mixinextras-forge:0.5.0")) { jarJar.ranged(it, "[0.5.0,)") } minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation fg.deobf("curse.maven:tfgambtwo-940350:5655440") {} implementation fg.deobf("curse.maven:terrafirmacraft-302973:5571484") implementation fg.deobf("curse.maven:patchouli-306770:4966125") implementation fg.deobf("curse.maven:jei-238222:5648527") implementation fg.deobf("curse.maven:curios-309927:5367944") implementation fg.deobf("curse.maven:tacz-1028108:6654541") implementation fg.deobf("maven.modrinth:prototype-pain:2.7.2") // compileOnly fg.deobf("curse.maven:prototype_pain-1333811:7393939") //returns a 403 for whatever reason implementation fg.deobf("curse.maven:prototype-physics-1380559:7206624") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' } tasks.named('processResources', ProcessResources).configure { var replaceProperties = [minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, forge_version : forge_version, forge_version_range: forge_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,] inputs.properties replaceProperties filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { expand replaceProperties + [project: project] } } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes(["Specification-Title" : mod_id, "Specification-Vendor" : mod_authors, "Specification-Version" : "1", // We are version 1 of ourselves "Implementation-Title" : project.name, "Implementation-Version" : project.jar.archiveVersion, "Implementation-Vendor" : mod_authors, "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")]) } // This is the preferred method to reobfuscate your jar file finalizedBy 'reobfJar' } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation }