build.gradle 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. sourceSets.main.resources { srcDir 'src/generated/resources' }
  60. repositories {
  61. maven {
  62. name 'Jared\'s Maven' // JEI
  63. url 'https://maven.blamejared.com/'
  64. }
  65. maven {
  66. name 'tterrag\'s Maven' // CTM
  67. url 'https://maven.tterrag.com/'
  68. }
  69. maven {
  70. name 'theillusivec4\'s Maven' // Curios
  71. url 'https://maven.theillusivec4.top/'
  72. }
  73. maven {
  74. name 'Tama\'s Maven' // Cross-Dim Commands
  75. url "https://maven.tamaized.com/releases"
  76. }
  77. maven {
  78. name 'Curseforge Maven' // Jade
  79. url "https://www.cursemaven.com"
  80. content {
  81. includeGroup "curse.maven"
  82. }
  83. }
  84. }
  85. dependencies {
  86. // jared
  87. //implementation fg.deobf("mezz.jei:jei-${project.minecraft_version}-forge:${project.jei_version}")
  88. // tterrag
  89. //runtimeOnly fg.deobf("team.chisel.ctm:CTM:${project.minecraft_version}-${project.ctm_version}")
  90. // theillusivec4
  91. //implementation fg.deobf("top.theillusivec4.curios:curios-forge:${project.curios_version}+${project.minecraft_version}")
  92. //curse maven
  93. //implementation fg.deobf("curse.maven:jade-324717:4681833")
  94. //runtimeOnly fg.deobf("curse.maven:jeed-532286:4599236")
  95. //runtimeOnly fg.deobf("curse.maven:museum-curator-859070:4629894")
  96. //compileOnly fg.deobf("curse.maven:the-one-probe-245211:4629624")
  97. //mods we dont have compat with but are nice to have
  98. //runtimeOnly fg.deobf("team-twilight:crossdimcommands:${project.base_minecraft_version}-1.0")
  99. //minecraft
  100. implementation "net.neoforged:neoforge:${project.neo_version}"
  101. }
  102. tasks.named('jar', Jar).configure {
  103. manifest {
  104. archiveClassifier = 'universal'
  105. attributes([
  106. 'Specification-Title' : mod_id,
  107. 'Specification-Vendor' : "TeamTwilight",
  108. 'Specification-Version' : "1",
  109. 'Implementation-Title' : project.name,
  110. 'Implementation-Version' : project.jar.archiveVersion,
  111. 'Implementation-Vendor' : "TeamTwilight",
  112. 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  113. ])
  114. }
  115. }
  116. publishing {
  117. publications {
  118. mavenJava(MavenPublication) {
  119. afterEvaluate {
  120. artifact project.jar
  121. artifact project.sourceJar
  122. }
  123. setGroupId 'teamtwilight'
  124. setArtifactId project.mod_id
  125. }
  126. }
  127. repositories {
  128. maven {
  129. //url "file:///${project.projectDir}/mcmodsrepo"
  130. url "https://modmaven.dev:443/artifactory/local-releases"
  131. credentials {
  132. username System.getenv('ARTIFACTORY_USER')
  133. password System.getenv('ARTIFACTORY_PASS')
  134. }
  135. }
  136. }
  137. }
  138. tasks.register('sourceJar', Jar) {
  139. dependsOn 'classes'
  140. from sourceSets.main.allSource
  141. archiveClassifier = 'sources'
  142. }
  143. tasks.withType(JavaCompile).configureEach {
  144. options.encoding = 'UTF-8'
  145. }