1- // Credit for getting Mixins to work:
2- // https://github.com/Darkhax-Minecraft/Nautilus/blob/master/build.gradle
3-
41buildscript {
52 repositories {
6- jcenter()
73 maven {
8- name = " Forge"
9- url ' http://files.minecraftforge.net/maven'
4+ url " http://files.minecraftforge.net/maven"
105 }
11- maven {
12- url ' http://repo.spongepowered.org/maven'
13- }
146 maven {
15- url ' https://plugins.gradle .org/m2/ '
7+ url " https://repo.spongepowered .org/repository/maven-public/ "
168 }
9+ gradlePluginPortal()
10+ // jcenter()
11+ mavenCentral()
1712 }
1813 dependencies {
19- classpath ' net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
20- classpath ' org.spongepowered:mixingradle:0.6-SNAPSHOT'
21- classpath ' gradle.plugin.com.matthewprenger:CurseGradle:1.4.0'
14+ classpath ' net.minecraftforge.gradle:ForgeGradle:3.+'
15+ classpath ' org.spongepowered:mixingradle:0.7-SNAPSHOT'
2216 }
2317}
2418
25- apply plugin : ' net.minecraftforge.gradle.forge '
19+ apply plugin : ' net.minecraftforge.gradle'
2620apply plugin : ' org.spongepowered.mixin'
27- apply plugin : ' com.matthewprenger.cursegradle'
28- apply plugin : ' maven-publish'
21+ apply plugin : ' maven-publish'
22+
23+ // apply from: 'configuration.gradle'
2924
30- apply from : ' configuration.gradle'
25+ version = mod_version
26+ group = mod_group
27+ archivesBaseName = mod_id
3128
3229if (file(' secrets.properties' ). exists()) {
33- println " Loading parameters from secrets.properties"
34- ext. secrets = new Properties ()
35- file(' secrets.properties' ). withReader {ext. secrets. load(it)}
30+ println " Loading parameters from secrets.properties"
31+ ext. secrets = new Properties ()
32+ file(' secrets.properties' ). withReader {ext. secrets. load(it)}
3633}
3734
3835repositories {
39- maven { url " http://chickenbones.net/maven/" }
40- maven { url " http://dvs1.progwml6.com/files/maven" }
41- maven { url " http://maven.tterrag.com" }
42- maven { url " https://repo.elytradev.com/" }
43- maven { url ' http://repo.spongepowered.org/maven' }
44- maven { url ' https://maven.mcmoddev.com' }
45- maven { url " https://maven.blamejared.com/" }
46- maven {
47- name = " CurseForge"
48- url = " https://minecraft.curseforge.com/api/maven/"
49- }
36+ maven { url = " https://dvs1.progwml6.com/files/maven" }
37+ maven { url = " https://maven.tterrag.com" }
38+ maven { url = " https://repo.elytradev.com/" }
39+ maven { url = ' https://repo.spongepowered.org/maven' }
40+ maven { url = ' https://maven.mcmoddev.com' }
41+ maven { url = " https://maven.blamejared.com/" }
42+ maven { url = " https://maven.covers1624.net/" }
43+ maven { url = " https://cursemaven.com" }
5044}
5145
52- sourceCompatibility = targetCompatibility = JavaVersion . VERSION_1_8
46+ sourceCompatibility = targetCompatibility = compileJava . sourceCompatibility = compileJava . targetCompatibility = ' 1.8 ' // Need this here so eclipse task generates correctly.
5347
5448minecraft {
55- if (project. ext. has(' secrets' )) {
56- if (project. ext. secrets. uuid != null )
57- clientRunArgs.AddAll ([" --uuid ${ project.ext.secrets.uuid} " ])
58- if (project. ext. secrets. username != null )
59- clientRunArgs.AddAll ([" --username ${ project.ext.secrets.username} " ])
60- if (project. ext. secrets. password != null )
61- clientRunArgs.AddAll ([" --password ${ project.ext.secrets.password} " ])
62- if (project. ext. secrets. jvmArgs != null ) {
63- clientJvmArgs.AddAll (project. ext. secrets. jvmArgs)
64- serverJvmArgs.AddAll (project. ext. secrets. jvmArgs)
65- }
49+ // The mappings can be changed at any time, and must be in the following format.
50+ // snapshot_YYYYMMDD Snapshot are built nightly.
51+ // stable_# Stables are built at the discretion of the MCP team.
52+ // Use non-default mappings at your own risk. they may not always work.
53+ // Simply re-run your setup task after changing the mappings to update your workspace.
54+ // mappings channel: 'snapshot', version: '20171003-1.12'
55+ mappings channel : ' snapshot' , version : ' 20171003-1.12'
56+ // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
57+
58+ // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
59+
60+ // Default run configurations.
61+ // These can be tweaked, removed, or duplicated as needed.
62+ runs {
63+ client {
64+ workingDirectory project. file(' run' )
65+ property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
66+ property ' forge.logging.console.level' , ' debug'
67+ property ' fml.coreMods.load' , mod_core_plugin. replace(' ${mod_group}' , mod_group). replace(' ${mod_id}' , mod_id)
68+
69+ if (project. ext. has(' secrets' )) {
70+ if (secrets. uuid != null )
71+ args ' --uuid' , " ${ secrets.uuid} "
72+ if (secrets. username != null )
73+ args ' --username' , " ${ secrets.username} "
74+ if (secrets. password != null )
75+ args ' --password' , " ${ secrets.password} "
76+ }
77+ }
78+
79+ server {
80+ property ' fml.coreMods.load' , mod_core_plugin. replace(' ${mod_group}' , mod_group). replace(' ${mod_id}' , mod_id)
81+ property ' forge.logging.markers' , ' SCAN,REGISTRIES,REGISTRYDUMP'
82+ property ' forge.logging.console.level' , ' debug'
83+ }
6684 }
85+ }
6786
68- runDir = " run"
69- replace ' @VERSION@' , project. ext. modVersion
70- replace ' @FINGERPRINT@' , project. ext. fingerprint
71- replace ' @UPDATEURL@' , project. ext. updateurl
72- mappings = project. ext. snapshot
87+ configurations {
88+ embed
89+ compile. extendsFrom(embed)
7390}
7491
75- sourceSets {
76- main {
77- ext. refMap = " mixins.dsurround.refmap.json"
78- }
92+ mixin {
93+ add sourceSets. main, " mixins.dsurround.refmap.json"
7994}
8095
8196dependencies {
82- compile " craftstudio-api:CraftStudioAPI-universal-1.0.1.95:mc1.12:alpha"
83- compile " com.animania:animania-${ project.mcVersion} -base:${ project.animaniaBaseVersion} "
84- compile " com.animania:animania-${ project.mcVersion} -farm:${ project.animaniaFarmVersion} "
85- compile " com.animania:animania-${ project.mcVersion} -extra:${ project.animaniaExtraVersion} "
86- compile " serene-seasons:SereneSeasons-${ project.mcVersion} :${ project.ssVersion} :universal"
87- compile " codechicken-lib-1-8:CodeChickenLib-1.12.2:3.2.3.358:universal"
88- compile " forge-multipart-cbe:ForgeMultipart-1.12.2:2.6.2.83:universal"
89- compile " ctm:CTM:MC1.12.2:${ project.ctmVersion} "
90- compile " cosmetic-armor-reworked:CosmeticArmorReworked:1.12.2:v3"
91- compile " littletiles:LittleTiles_v1.5.0:pre169_mc1.12.2"
92- compile " iron-chests:ironchest:1.12.2:7.0.72.847"
93- compile " biomes-o-plenty:BiomesOPlenty-1.12.2:7.0.1.2441:universal"
94- compile " org.spongepowered:mixin:0.8.2"
95- compile ' mcjty.theoneprobe:TheOneProbe-1.12:1.12-1.4.28-17'
96-
97- // compile "creativecore:CreativeCore_v1.9.35_mc1.12.2"
98-
99- deobfCompile " mezz.jei:jei_${ project.mcVersion} :${ project.jeiVersion} :api"
100- runtime " mezz.jei:jei_${ project.mcVersion} :${ project.jeiVersion} "
101- deobfCompile " team.chisel:Chisel:MC${ project.mcVersion} -${ project.chiselVersion} "
97+ // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
98+ // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
99+ // The userdev artifact is a special name and will get all sorts of transformations applied to it.
100+ minecraft ' net.minecraftforge:forge:1.12.2-14.23.5.2855'
101+
102+ compile " curse.maven:CraftStudioAPI-268704:2661859"
103+ compile " com.animania:animania-${ minecraft_version} -base:2.0.3.28"
104+ compile " com.animania:animania-${ minecraft_version} -farm:1.0.2.28"
105+ compile " com.animania:animania-${ minecraft_version} -extra:1.0.2.28"
106+ compileOnly " curse.maven:CosmeticArmorReworked-237307:2660068"
107+ compileOnly " curse.maven:IronChest-228756:2747935"
108+ compileOnly " curse.maven:TheOneProbe-245211:2667280"
109+ compileOnly " mezz.jei:jei_${ minecraft_version} :4.16.1.301"
102110
103111 if (fileTree(dir : ' libs' ). filter { it. name. startsWith(' OreLib' ) }. getFiles(). size() == 0 )
104- compile " orelib:OreLib:1.12.2:3.6.0.1"
112+ compile " curse.maven:OreLib-307806:2820815"
113+
114+ compileOnly " team.chisel:Chisel:MC${ minecraft_version} -1.0.2.45"
115+ compileOnly " curse.maven:BiomesOPlenty-220318:2715506"
116+ compileOnly " curse.maven:CreativeCore-257814:3467576"
117+ compileOnly " curse.maven:LittleTiles-257818:3483878"
118+ compileOnly " curse.maven:SereneSeasons-291874:2799213"
119+ compileOnly " curse.maven:CTM-267602:2915363"
120+
121+ embed(" org.spongepowered:mixin:0.8" ) {
122+ exclude module : " asm-commons"
123+ exclude module : " asm-tree"
124+ exclude module : " launchwrapper"
125+ exclude module : " guava"
126+ exclude module : " log4j-core"
127+ exclude module : " gson"
128+ exclude module : " commons-io"
129+ }
105130}
106131
107- processResources
108- {
109- // this will ensure that this task is redone when the versions change.
132+ processResources {
110133 inputs. property " version" , project. version
111- inputs. property " mcversion" , project . minecraft . version
134+ inputs. property " mcversion" , minecraft_version
112135
113- // replace stuff in mcmod.info, nothing else
114136 from(sourceSets. main. resources. srcDirs) {
115137 include ' mcmod.info'
116-
117- // replace version and mcversion
118- expand ' version' :project. version, ' mcversion' :project. minecraft. version
138+
139+ expand ' mod_id' : mod_id, ' mod_name' : mod_name, ' version' : project. version,
140+ ' mcversion' : minecraft_version, ' mod_description' : mod_description,
141+ ' mod_author' : mod_author, ' update_url' : update_url
119142 }
120-
121- // copy everything else that's not the mcmod.info
143+
122144 from(sourceSets. main. resources. srcDirs) {
123145 exclude ' mcmod.info'
124146 }
125147}
126148
149+ // Example for how to get properties into the manifest for reading by the runtime..
127150jar {
151+ from {
152+ configurations. embed. collect { it. isDirectory() ? it : zipTree(it) }
153+ } {
154+ exclude " LICENSE.txt" , " META-INF/MANIFSET.MF" , " META-INF/maven/**" , " META-INF/*.RSA" , " META-INF/*.SF"
155+ }
156+
128157 // Add CREDITS.md
129158 into(' /' ) {
130159 from(' CREDITS.md' )
131160 }
132-
133- manifest. attributes(
134- " FMLCorePluginContainsFMLMod" : " true" ,
135- " ForceLoadAsMod" : " true" ,
136- " TweakClass" : " org.spongepowered.asm.launch.MixinTweaker" ,
137- " MixinConfigs" : " mixins.dsurround.json" ,
138- " FMLCorePlugin" : " org.orecruncher.dsurround.mixins.TransformLoader"
139- )
140- }
141161
142- // https://gist.github.com/matthewprenger/9b2da059b89433a01c1c
143- task signJar (type : SignJar ) {
144- onlyIf { // Skip the task if our secret data isn't available
145- project. hasProperty(' keyStore' )
162+ manifest {
163+ attributes([
164+ " FMLCorePlugin" : mod_core_plugin. replace(' ${mod_group}' , mod_group). replace(' ${mod_id}' , mod_id),
165+ " FMLCorePluginContainsFMLMod" : " false" ,
166+ " ForceLoadAsMod" : " true" ,
167+ " TweakClass" : " org.spongepowered.asm.launch.MixinTweaker" ,
168+ " MixinConfigs" : mod_mixin_configs. replace(' ${mod_id}' , mod_id),
169+ " Specification-Title" : " ${ mod_id} " ,
170+ " Specification-Vendor" : " OreCruncher" ,
171+ " Specification-Version" : " 1" , // We are version 1 of ourselves
172+ " Implementation-Title" : project. name,
173+ " Implementation-Version" : " ${ minecraft_version} -${ mod_version} " ,
174+ " Implementation-Vendor" :" OreCruncher" ,
175+ " Implementation-Timestamp" : new Date (). format(" yyyy-MM-dd'T'HH:mm:ssZ" )
176+ ])
146177 }
147-
148- keyStore = project. keyStore // This needs to be a path to the keystore file
149- alias = project. keyStoreAlias
150- storePass = project. keyStorePass
151- keyPass = project. keyStoreKeyPass
152- inputFile = jar. archivePath
153- outputFile = jar. archivePath
154178}
155179
156- build. dependsOn signJar
180+ // Example configuration to allow publishing using the maven-publish task
181+ // This is the preferred method to reobfuscate your jar file
182+ jar. finalizedBy(' reobfJar' )
183+ // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
184+ // publish.dependsOn('reobfJar')
185+
186+ publishing {
187+ publications {
188+ mavenJava(MavenPublication ) {
189+ artifact jar
190+ }
191+ }
192+ repositories {
193+ maven {
194+ url " file:///${ project.projectDir} /mcmodsrepo"
195+ }
196+ }
197+ }
0 commit comments