build.gradle 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. // define the properties file
  2. ext.configFile = file "gradle.properties"
  3. configFile.withReader {
  4. // read config. it shall from now on be referenced as simply config or as project.config
  5. def prop = new Properties()
  6. prop.load(it)
  7. project.ext.config = new ConfigSlurper().parse prop
  8. }
  9. // For those who want the bleeding edge
  10. buildscript {
  11. repositories {
  12. maven { url = 'https://files.minecraftforge.net/maven' }
  13. jcenter()
  14. mavenCentral()
  15. }
  16. dependencies {
  17. classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
  18. }
  19. }
  20. apply plugin: 'java'
  21. apply plugin: 'idea'
  22. apply plugin: 'net.minecraftforge.gradle'
  23. apply plugin: 'maven-publish'
  24. apply plugin: 'eclipse'
  25. ///////////////////////////////////////////////////
  26. // IDE Settings
  27. ///////////////////////////////////////////////////
  28. idea {
  29. project {
  30. languageLevel = '1.8'
  31. }
  32. }
  33. ///////////////////////////////////////////////////
  34. // ForgeGradle
  35. ///////////////////////////////////////////////////
  36. version = (hasProperty("CIRevision") ? CIRevision : config.mod_version)
  37. group = config.group_name
  38. archivesBaseName = "${config.mod_id}-${config.minecraft_version}"
  39. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
  40. compileJava.options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation" << "-Werror"
  41. minecraft {
  42. mappings channel: "snapshot", version: config.mcp_mappings
  43. //version = config.minecraft_version + "-" + config.forge_version // grab latest forge
  44. //makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
  45. accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  46. //replace '@mod_version@', version
  47. //replace '@mod_id@', config.mod_id
  48. //replace '@ci_build@', hasProperty("CIRevision") ? 'true' : 'false'
  49. //replaceIn 'TwilightForestMod.java'
  50. //replace '@VERSION@', project.version
  51. runs {
  52. client {
  53. workingDirectory project.file('run')
  54. property 'forge.logging.markers', 'REGISTRIES'
  55. property 'forge.logging.console.level', 'debug'
  56. property 'fml.earlyprogresswindow', 'false'
  57. property 'mixin.env.disableRefMap', 'true'
  58. mods {
  59. twilightforest {
  60. source sourceSets.main
  61. }
  62. }
  63. }
  64. server {
  65. workingDirectory project.file('run')
  66. // Recommended logging level for the console
  67. property 'forge.logging.console.level', 'debug'
  68. property 'mixin.env.disableRefMap', 'true'
  69. mods {
  70. twilightforest {
  71. source sourceSets.main
  72. }
  73. }
  74. }
  75. data {
  76. workingDirectory project.file('run')
  77. properties 'fml.earlyprogresswindow': 'false'
  78. property 'mixin.env.disableRefMap', 'true'
  79. mods {
  80. twilightforest {
  81. source sourceSets.main
  82. }
  83. }
  84. args '--mod', 'twilightforest', '--all',
  85. '--existing', '"' + file('src/main/resources/') + '"',
  86. '--existing', '"' + file('src/generated/resources/') + '"',
  87. '--output', '"' + file('src/generated/resources/') + '"'
  88. }
  89. }
  90. }
  91. sourceSets.main.resources {
  92. srcDir 'src/generated/resources'
  93. }
  94. /*
  95. processResources {
  96. //replaceIn 'assets/twilightforest/patchouli_books/guide/book.json'
  97. //replace '@EDITION@', project.version
  98. // this will ensure that this task is redone when the versions change.
  99. inputs.property "version", project.version
  100. inputs.property "mcversion", project.minecraft.version
  101. // replace stuff in mcmod.info, nothing else
  102. from(sourceSets.main.resources.srcDirs) {
  103. //include '.info'
  104. //include '.properties'
  105. include 'assets/twilightforest/patchouli_books/guide/book.json'
  106. // replace version and mcversion
  107. expand ([
  108. 'version':project.version,
  109. 'mcversion':project.minecraft.version,
  110. 'forge_version': config.forge_version,
  111. 'mod_version': config.mod_version,
  112. 'minecraft_version': config.minecraft_version,
  113. 'edition': (project.version - (config.mod_version + '.')),
  114. 's': '$'
  115. ])
  116. }
  117. // copy everything else, thats not the mcmod.info
  118. from(sourceSets.main.resources.srcDirs) {
  119. exclude 'mcmod.info'
  120. exclude 'assets/twilightforest/patchouli_books/guide/book.json'
  121. }
  122. }*/
  123. compileJava {
  124. options.encoding = 'UTF-8'
  125. }
  126. jar {
  127. classifier = 'universal'
  128. }
  129. repositories {
  130. maven {
  131. name 'progwm\'s Maven' // JEI + Mantle + TCon
  132. url 'https://dvs1.progwml6.com/files/maven'
  133. }
  134. maven {
  135. name 'tterrag\'s Maven' // CTM
  136. url 'https://maven.tterrag.com/'
  137. }
  138. maven {
  139. // Temporary mappings
  140. url 'https://www.dogforce-games.com/maven/'
  141. }
  142. maven {
  143. name 'Jared\'s Maven' // Immersive Engineering + Patchouli
  144. url 'https://maven.blamejared.com/'
  145. }
  146. maven {
  147. name 'theillusivec4\'s Maven' //Curios
  148. url 'https://maven.theillusivec4.top/'
  149. }
  150. /*maven {
  151. name 'player\'s Maven' // Forestry
  152. url 'http://maven.ic2.player.to/'
  153. }*/
  154. }
  155. dependencies {
  156. // progwml6
  157. compileOnly fg.deobf("mezz.jei:jei-1.16.5:${jei_version}:api")
  158. runtimeOnly fg.deobf("mezz.jei:jei-1.16.5:${jei_version}")
  159. //implementation fg.deobf("slimeknights.mantle:Mantle:${minecraft_sub_version}-${mantle_version}")
  160. //implementation fg.deobf("slimeknights:TConstruct:${minecraft_version}-${tcon_version}")
  161. // tterrag
  162. implementation fg.deobf("team.chisel.ctm:CTM:${ctm_version}")
  163. // blamejared
  164. implementation fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${immersive_engineering_version}")
  165. implementation fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}")
  166. // theillusivec4
  167. compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api")
  168. runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}")
  169. // player
  170. //deobfCompile "net.sengir.forestry:forestry_${minecraft_version}:${forestry_version}"
  171. minecraft "net.minecraftforge:forge:${project.minecraft_version}-${project.forge_version}"
  172. }
  173. jar.finalizedBy('reobfJar')
  174. publishing {
  175. publications {
  176. mavenJava(MavenPublication) {
  177. artifact jar
  178. artifact sourceJar
  179. setGroupId 'teamtwilight'
  180. setArtifactId mod_id
  181. }
  182. }
  183. repositories {
  184. maven {
  185. //url "file:///${project.projectDir}/mcmodsrepo"
  186. url "https://modmaven.dev:443/artifactory/local-releases"
  187. credentials {
  188. username System.getenv('ARTIFACTORY_USER')
  189. password System.getenv('ARTIFACTORY_PASS')
  190. }
  191. }
  192. }
  193. }
  194. task sourceJar(type: Jar, dependsOn: 'classes') {
  195. from sourceSets.main.allSource
  196. classifier = 'sources'
  197. }