buildscript { repositories { mavenCentral() jcenter() maven { name = "forge" url = "https://repo.spongepowered.org/repository/forge-proxy/" } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' // MixinGradle only works with ForgeGradle 2+, so we need to implement it ourselves. // (Comments mark the lines where this is done.) //classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' } } repositories { maven { // this has to be here and not in buildscript.repositories, otherwise Gradle won't find mixin <0.8 for some reason name = 'sponge' url = 'https://repo.spongepowered.org/maven/' } } configurations { embed compile.extendsFrom(embed) } apply plugin: 'forge' version = "0.0" group= "makamys.lodmod" // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "lodmod" minecraft { version = "1.7.10-10.13.4.1614-1.7.10" runDir = "run" } sourceCompatibility = 1.8 targetCompatibility = 1.8 dependencies { embed 'org.spongepowered:mixin:0.7+' /* Mixin 0.8 breaks with 1.7.10, but can be made to work by embedding these. However, doing so overrides the libraries provided by Forge, which will likely result in other mods breaking. */ //embed 'org.ow2.asm:asm-all:5.2' //embed 'com.google.guava:guava:21.0' } def outRefMapFile = tasks.compileJava.temporaryDir.toString() + "/lodmod.mixin.refmap.json" // 1.7.10 mixin compatibility jar { manifest { attributes ( 'MixinConfigs': 'lodmod.mixin.json', 'TweakClass': 'org.spongepowered.asm.launch.MixinTweaker', 'TweakOrder': 0, // If these two are not set, Forge will not detect the mod, it will only run the mixins 'FMLCorePluginContainsFMLMod': 'true', 'ForceLoadAsMod': 'true', 'FMLAT': "LODMod_at.cfg" ) } from(sourceSets.main.output); from outRefMapFile; // 1.7.10 mixin compatibility // embed libraries in jar from configurations.embed.collect { exclude '**/LICENSE.txt' it.isDirectory() ? it : zipTree(it) } } // 1.7.10 mixin compatibility def outSrgFile = tasks.compileJava.temporaryDir.toString() + "/outSrg.srg" afterEvaluate { tasks.compileJava.options.compilerArgs += ["-AreobfSrgFile=${tasks.reobf.srg}", "-AoutSrgFile=${outSrgFile}", "-AoutRefMapFile=${outRefMapFile}"]; } reobf { addExtraSrgFile outSrgFile } // end of mixin stuff processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } }