build.gradle 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. plugins {
  2. id 'eclipse'
  3. id 'idea'
  4. id 'maven-publish'
  5. id 'net.neoforged.gradle' version '[6.0.18,6.2)'
  6. id 'org.parchmentmc.librarian.forgegradle' version '1.+'
  7. }
  8. def secrets = new Properties()
  9. def secretsFile = file('secrets.properties')
  10. if (secretsFile.exists()) {
  11. secretsFile.withInputStream {
  12. stream -> secrets.load(stream)
  13. }
  14. fileTree("secrets").matching {
  15. include "**/*.properties"
  16. }.each {
  17. File file ->
  18. file.withInputStream {
  19. stream -> secrets.load(stream)
  20. }
  21. }
  22. }
  23. version = (hasProperty("CIRevision") ? CIRevision : project.mod_version)
  24. group = group_name
  25. base {
  26. archivesName = "${project.mod_id}-${project.minecraft_version}"
  27. }
  28. java.toolchain.languageVersion = JavaLanguageVersion.of(17)
  29. compileJava.options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation" << "-Werror"
  30. minecraft {
  31. // https://ldtteam.jfrog.io/ui/native/parchmentmc-public/org/parchmentmc/data
  32. mappings channel: mapping_channel, version: mapping_version
  33. copyIdeResources = true
  34. accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  35. runs {
  36. configureEach {
  37. workingDirectory project.file('run')
  38. property 'forge.logging.console.level', 'debug'
  39. property 'fml.earlyprogresswindow', 'false'
  40. property 'mixin.env.disableRefMap', 'true'
  41. mods {
  42. "${mod_id}" {
  43. source sourceSets.main
  44. }
  45. }
  46. }
  47. client {
  48. taskName "Minecraft_Client_${project.minecraft_version}"
  49. property 'forge.enabledGameTestNamespaces', mod_id
  50. args '--username', secrets.getProperty("username")?: 'Dev', secrets.getProperty("uuid") ? '--uuid' : '', secrets.getProperty("uuid")?: ''
  51. }
  52. server {
  53. taskName "Minecraft_Server_${project.minecraft_version}"
  54. property 'forge.enabledGameTestNamespaces', mod_id
  55. args '--nogui'
  56. }
  57. gameTestServer {
  58. taskName "Minecraft_GameTestServer_${project.minecraft_version}"
  59. property 'forge.enabledGameTestNamespaces', mod_id
  60. }
  61. data {
  62. taskName "Minecraft_Data_${project.minecraft_version}"
  63. workingDirectory project.file('run-data')
  64. args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  65. }
  66. }
  67. }
  68. sourceSets.main.resources { srcDir 'src/generated/resources' }
  69. repositories {
  70. maven {
  71. name 'Jared\'s Maven' // JEI
  72. url 'https://maven.blamejared.com/'
  73. }
  74. maven {
  75. name 'tterrag\'s Maven' // CTM
  76. url 'https://maven.tterrag.com/'
  77. }
  78. maven {
  79. name 'theillusivec4\'s Maven' // Curios
  80. url 'https://maven.theillusivec4.top/'
  81. }
  82. maven {
  83. name 'Tama\'s Maven' // Cross-Dim Commands
  84. url "https://maven.tamaized.com/releases"
  85. }
  86. maven {
  87. name 'Curseforge Maven' // Jade
  88. url "https://www.cursemaven.com"
  89. content {
  90. includeGroup "curse.maven"
  91. }
  92. }
  93. }
  94. dependencies {
  95. // jared
  96. implementation fg.deobf("mezz.jei:jei-${project.minecraft_version}-forge:${project.jei_version}")
  97. // tterrag
  98. //runtimeOnly fg.deobf("team.chisel.ctm:CTM:${project.minecraft_version}-${project.ctm_version}")
  99. // theillusivec4
  100. implementation fg.deobf("top.theillusivec4.curios:curios-forge:${project.curios_version}+${project.minecraft_version}")
  101. //curse maven
  102. implementation fg.deobf("curse.maven:jade-324717:4681833")
  103. runtimeOnly fg.deobf("curse.maven:jeed-532286:4599236")
  104. runtimeOnly fg.deobf("curse.maven:museum-curator-859070:4629894")
  105. compileOnly fg.deobf("curse.maven:the-one-probe-245211:4629624")
  106. //mods we dont have compat with but are nice to have
  107. runtimeOnly fg.deobf("team-twilight:crossdimcommands:${project.base_minecraft_version}-1.0")
  108. //minecraft
  109. minecraft "net.neoforged:forge:${project.minecraft_version}-${project.neo_version}"
  110. }
  111. tasks.named('jar', Jar).configure {
  112. manifest {
  113. archiveClassifier = 'universal'
  114. attributes([
  115. 'Specification-Title' : mod_id,
  116. 'Specification-Vendor' : "TeamTwilight",
  117. 'Specification-Version' : "1",
  118. 'Implementation-Title' : project.name,
  119. 'Implementation-Version' : project.jar.archiveVersion,
  120. 'Implementation-Vendor' : "TeamTwilight",
  121. 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  122. ])
  123. }
  124. finalizedBy 'reobfJar'
  125. }
  126. publishing {
  127. publications {
  128. mavenJava(MavenPublication) {
  129. afterEvaluate {
  130. artifact project.jar
  131. artifact project.sourceJar
  132. }
  133. setGroupId 'teamtwilight'
  134. setArtifactId project.mod_id
  135. }
  136. }
  137. repositories {
  138. maven {
  139. //url "file:///${project.projectDir}/mcmodsrepo"
  140. url "https://modmaven.dev:443/artifactory/local-releases"
  141. credentials {
  142. username System.getenv('ARTIFACTORY_USER')
  143. password System.getenv('ARTIFACTORY_PASS')
  144. }
  145. }
  146. }
  147. }
  148. tasks.register('sourceJar', Jar) {
  149. dependsOn 'classes'
  150. from sourceSets.main.allSource
  151. archiveClassifier = 'sources'
  152. }
  153. tasks.withType(JavaCompile).configureEach {
  154. options.encoding = 'UTF-8'
  155. }