aboutsummaryrefslogtreecommitdiff
path: root/buildscript/forge-1.7-mixin.gradle
blob: 60210e58983614b33ef10e30b9a5b7d5e6c2f1d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/** Applying this file in a Forge build will imbue it with the powers of Mixin. */

repositories {
	maven {
		name = 'sponge'
		url = 'https://repo.spongepowered.org/maven/'
	}
}

def embedMixin = !project.hasProperty("nomixin");

if(!embedMixin){
	project.version += "+nomixin"
}

dependencies {
	if(embedMixin){
		embed('org.spongepowered:mixin:0.7.11-SNAPSHOT'){
			setTransitive false
		}
	} else {
		implementation('org.spongepowered:mixin:0.7.11-SNAPSHOT'){
			setTransitive false
		}
	}
	annotationProcessor('org.spongepowered:mixin:0.7.11-SNAPSHOT')
}

ext.outRefMapFile = "${tasks.compileJava.temporaryDir}/${project.modid}.mixin.refmap.json"

jar {
	manifest {
        attributes (
			'MixinConfigs': "${project.modid}.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',
		)
	}
	
	from outRefMapFile;
}

def outSrgFile = "${tasks.compileJava.temporaryDir}/outSrg.srg"

afterEvaluate {
    tasks.compileJava.options.compilerArgs += ["-AreobfSrgFile=${tasks.reobf.srg}", "-AoutSrgFile=${outSrgFile}", "-AoutRefMapFile=${outRefMapFile}"];
}

reobf {
    addExtraSrgFile outSrgFile
}