build.gradle 7.8 KB

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