1+ plugins {
2+ id " com.github.johnrengelman.shadow" version " 6.1.0"
3+ id " net.minecraftforge.gradle.forge" version " 86b2392"
4+ id " org.jetbrains.kotlin.jvm" version " 1.5.21"
5+ id " org.spongepowered.mixin" version " d75e32e"
6+ id " java"
7+ }
8+
9+ version = mod_ver
10+ group = " net.wyvest"
11+ archivesBaseName = mod_name
12+
13+ sourceCompatibility = targetCompatibility = 1.8
14+ compileJava. options. encoding = " UTF-8"
15+
16+ minecraft {
17+ /* Define Minecraft properties. */
18+ version = " 1.8.9-11.15.1.2318-1.8.9"
19+ runDir = " run"
20+ mappings = " stable_22"
21+
22+ makeObfSourceJar = false
23+
24+ clientJvmArgs + = ' -Dfml.coreMods.load=net.wyvest.redaction.tweaker.RedactionLoadingPlugin'
25+ clientRunArgs + = ' --tweakClass net.wyvest.redaction.tweaker.RequisiteEssentialTweaker'
26+ clientRunArgs + = " --mixin mixins.redaction.json"
27+ }
28+
29+ configurations {
30+ /* This creates an additional dependency configuration which shades libraries into your built jar file and adds them to your workspace classpath. */
31+ shade
32+ implementation. extendsFrom(shade)
33+ }
34+
35+ repositories {
36+ /* Allows us to get dependencies from the central Maven repository. */
37+ mavenCentral()
38+
39+ /* Defines third-party repositories that we have to use for dependencies. */
40+ maven {
41+ name = ' Sk1er Public'
42+ url = ' https://repo.sk1er.club/repository/maven-releases/'
43+ }
44+ maven {
45+ name = ' Jitpack'
46+ url = ' https://jitpack.io/'
47+ }
48+ maven {
49+ name = ' Spongepowered Public'
50+ url = ' https://repo.spongepowered.org/repository/maven-public/'
51+ }
52+ maven {
53+ name = ' TGMDevelopment Public'
54+ url = ' http://maven.matthewtgm.xyz/repository/maven-public/'
55+ allowInsecureProtocol = true
56+ }
57+ }
58+
59+ dependencies {
60+ /* This defines dependencies required by the mod. */
61+ implementation(' xyz.matthewtgm:Requisite:1.1.1' )
62+ shade(' xyz.matthewtgm:RequisiteLaunchwrapper:1.1' ) {
63+ transitive = false
64+ }
65+ implementation(' gg.essential:essential-1.8.9-forge:1300' )
66+ shade(' gg.essential:loader-launchwrapper:1.1.0' ) {
67+ transitive = false
68+ }
69+
70+ annotationProcessor(" org.spongepowered:mixin:0.7.11-SNAPSHOT" )
71+ implementation " org.jetbrains.kotlin:kotlin-stdlib-jdk8"
72+ }
73+
74+ mixin {
75+ /* Stops mixin from warning us about duplicate refmaps. We don't care. */
76+ disableRefMapWarning = true
77+
78+ /* Sets the mixin obfuscation environment to SEARGE. */
79+ defaultObfuscationEnv = searge
80+
81+ /* Adds our refmap to our main sourceset. */
82+ add sourceSets. main, " mixins.redaction.refmap.json"
83+ }
84+
85+ jar {
86+ /* Defines qualities for Forge and external mods or libraries to use. */
87+ manifest. attributes(
88+ ' ModSide' : ' CLIENT' ,
89+ ' FMLCorePlugin' : ' net.wyvest.redaction.tweaker.RedactionLoadingPlugin' ,
90+ ' FMLCorePluginContainsFMLMod' : true ,
91+ ' ForceLoadAsMod' : true ,
92+ " MixinConfigs" : " mixins.redaction.json" ,
93+ ' TweakClass' : ' net.wyvest.redaction.tweaker.RequisiteEssentialTweaker' ,
94+ ' TweakOrder' : ' 0'
95+ )
96+
97+ /* Disables the default jar so we can use a custom naming scheme. */
98+ enabled = false
99+ }
100+
101+ /* This task simply replaces the `${version}` and `${mcversion}` properties in the mcmod.info with the data from Gradle. */
102+ processResources {
103+ // this will ensure that this task is redone when the versions change.
104+ inputs. property " version" , project. version
105+ inputs. property " mcversion" , project. minecraft. version
106+
107+ // replace stuff in mcmod.info, nothing else
108+ from(sourceSets. main. resources. srcDirs) {
109+ include " mcmod.info"
110+
111+ // replace version and mcversion
112+ expand " version" : project. version, " mcversion" : project. minecraft. version
113+ }
114+
115+ // copy everything else, thats not the mcmod.info
116+ from(sourceSets. main. resources. srcDirs) {
117+ exclude " mcmod.info"
118+ }
119+ }
120+
121+ /* Moves resources from our own resources to the build's resources, Forge doesn't work properly. */
122+ task moveResources {
123+ doLast {
124+ ant. move file : " ${ buildDir} /resources/main" ,
125+ todir : " ${ buildDir} /classes/java"
126+ }
127+ }
128+
129+ moveResources. dependsOn processResources
130+ classes. dependsOn moveResources
131+
132+ /* This will force shadowJar to be ran after jar */
133+ tasks. jar. finalizedBy(tasks. shadowJar)
134+
135+ // This adds support to our "shade" dependency configuration so we can embed our libraries into our jar file.
136+ shadowJar {
137+ archiveClassifier. set(" " )
138+ configurations = [project. configurations. shade]
139+ duplicatesStrategy = DuplicatesStrategy . EXCLUDE
140+
141+ exclude ' LICENSE.md'
142+ exclude ' pack.mcmeta'
143+ exclude ' dummyThing'
144+ exclude ' **/module-info.class'
145+ exclude ' *.so'
146+ exclude ' *.dylib'
147+ exclude ' *.dll'
148+ exclude ' *.jnilib'
149+ exclude ' ibxm/**'
150+ exclude ' com/jcraft/**'
151+ exclude ' org/lwjgl/**'
152+ exclude ' net/java/**'
153+
154+ exclude ' META-INF/proguard/**'
155+ exclude ' META-INF/maven/**'
156+ exclude ' META-INF/versions/**'
157+ exclude ' META-INF/com.android.tools/**'
158+
159+ exclude ' fabric.mod.json'
160+ }
161+ compileKotlin {
162+ kotlinOptions {
163+ jvmTarget = " 1.8"
164+ }
165+ }
166+ compileTestKotlin {
167+ kotlinOptions {
168+ jvmTarget = " 1.8"
169+ }
170+ }
0 commit comments