build.gradle 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. plugins {
  2. id 'java-library'
  3. id 'eclipse'
  4. id 'idea'
  5. id 'maven-publish'
  6. id 'net.neoforged.gradle.userdev' version '7.0.+'
  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. minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
  30. compileJava.options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation" << "-Werror"
  31. runs {
  32. configureEach {
  33. workingDirectory project.file('run')
  34. systemProperty 'forge.logging.console.level', 'debug'
  35. systemProperty 'fml.earlyprogresswindow', 'false'
  36. systemProperty 'mixin.env.disableRefMap', 'true'
  37. modSource project.sourceSets.main
  38. }
  39. client {
  40. // name "Minecraft_Client_${project.minecraft_version}"
  41. systemProperty 'forge.enabledGameTestNamespaces', mod_id
  42. programArguments.addAll '--username', secrets.getProperty("username")?: 'Dev', secrets.getProperty("uuid") ? '--uuid' : '', secrets.getProperty("uuid")?: ''
  43. }
  44. server {
  45. // name "Minecraft_Server_${project.minecraft_version}"
  46. systemProperty 'forge.enabledGameTestNamespaces', mod_id
  47. programArgument '--nogui'
  48. }
  49. gameTestServer {
  50. // name "Minecraft_GameTestServer_${project.minecraft_version}"
  51. systemProperty 'forge.enabledGameTestNamespaces', mod_id
  52. }
  53. data {
  54. // name "Minecraft_Data_${project.minecraft_version}"
  55. workingDirectory project.file('run-data')
  56. programArguments.addAll '--mod', mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
  57. }
  58. }
  59. subsystems {
  60. parchment {
  61. minecraftVersion = "1.20.3" //parchment doesnt support 1.20.4 yet????
  62. mappingsVersion = project.parchment_version
  63. }
  64. }
  65. sourceSets.main.resources { srcDir 'src/generated/resources' }
  66. repositories {
  67. maven {
  68. name 'Jared\'s Maven' // JEI
  69. url 'https://maven.blamejared.com/'
  70. }
  71. maven {
  72. name 'tterrag\'s Maven' // CTM
  73. url 'https://maven.tterrag.com/'
  74. }
  75. maven {
  76. name 'theillusivec4\'s Maven' // Curios
  77. url 'https://maven.theillusivec4.top/'
  78. }
  79. maven {
  80. name 'Tama\'s Maven' // Cross-Dim Commands
  81. url "https://maven.tamaized.com/releases"
  82. }
  83. maven {
  84. name 'Shedaniel\'s Maven' //REI
  85. url "https://maven.shedaniel.me"
  86. }
  87. maven {
  88. name = "TerraformersMC" //EMI
  89. url = "https://maven.terraformersmc.com/"
  90. }
  91. maven {
  92. name 'Curseforge Maven' // Jade
  93. url "https://www.cursemaven.com"
  94. content {
  95. includeGroup "curse.maven"
  96. }
  97. }
  98. }
  99. dependencies {
  100. //make sure to only pick one of these when testing (switch others to compileOnly)
  101. implementation "mezz.jei:jei-${project.minecraft_version}-neoforge:${project.jei_version}"
  102. compileOnly "me.shedaniel:RoughlyEnoughItems-neoforge:${project.rei_version}"
  103. compileOnly "dev.emi:emi-neoforge:${project.emi_version}+${project.minecraft_version}"
  104. // theillusivec4
  105. implementation "top.theillusivec4.curios:curios-neoforge:${project.curios_version}+${project.minecraft_version}"
  106. //curse maven
  107. compileOnly "curse.maven:jade-324717:4980188"
  108. //runtimeOnly "curse.maven:jeed-532286:4599236"
  109. //runtimeOnly "curse.maven:museum-curator-859070:4629894"
  110. compileOnly"curse.maven:the-one-probe-245211:5084077"
  111. //mods we dont have compat with but are nice to have
  112. //runtimeOnly "team-twilight:crossdimcommands:${project.base_minecraft_version}-1.0"
  113. //minecraft
  114. implementation "net.neoforged:neoforge:${project.neo_version}"
  115. }
  116. tasks.named('jar', Jar).configure {
  117. manifest {
  118. archiveClassifier = 'universal'
  119. attributes([
  120. 'Specification-Title' : mod_id,
  121. 'Specification-Vendor' : "TeamTwilight",
  122. 'Specification-Version' : "1",
  123. 'Implementation-Title' : project.name,
  124. 'Implementation-Version' : project.jar.archiveVersion,
  125. 'Implementation-Vendor' : "TeamTwilight",
  126. 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  127. ])
  128. }
  129. }
  130. publishing {
  131. publications {
  132. mavenJava(MavenPublication) {
  133. afterEvaluate {
  134. artifact project.jar
  135. artifact project.sourceJar
  136. }
  137. setGroupId 'teamtwilight'
  138. setArtifactId project.mod_id
  139. }
  140. }
  141. repositories {
  142. maven {
  143. //url "file:///${project.projectDir}/mcmodsrepo"
  144. url "https://modmaven.dev:443/artifactory/local-releases"
  145. credentials {
  146. username System.getenv('ARTIFACTORY_USER')
  147. password System.getenv('ARTIFACTORY_PASS')
  148. }
  149. }
  150. }
  151. }
  152. tasks.register('sourceJar', Jar) {
  153. dependsOn 'classes'
  154. from sourceSets.main.allSource
  155. archiveClassifier = 'sources'
  156. }
  157. tasks.withType(JavaCompile).configureEach {
  158. options.encoding = 'UTF-8'
  159. }
  160. idea {
  161. // Tell IDEA to always download sources/javadoc artifacts from maven.
  162. module {
  163. downloadJavadoc = true
  164. downloadSources = true
  165. }
  166. }