build.gradle 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. plugins {
  2. id 'eclipse'
  3. id 'maven-publish'
  4. id 'net.minecraftforge.gradle' version '5.1.+'
  5. }
  6. version = '0.2.1'
  7. group = 'com.zjinja.mcmod.zry_client_utils_mod' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  8. archivesBaseName = 'zry_client_utils_mod'
  9. // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
  10. java.toolchain.languageVersion = JavaLanguageVersion.of(17)
  11. println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
  12. minecraft {
  13. // The mappings can be changed at any time and must be in the following format.
  14. // Channel: Version:
  15. // official MCVersion Official field/method names from Mojang mapping files
  16. // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
  17. //
  18. // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
  19. // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
  20. //
  21. // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
  22. // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
  23. //
  24. // Use non-default mappings at your own risk. They may not always work.
  25. // Simply re-run your setup task after changing the mappings to update your workspace.
  26. mappings channel: 'official', version: '1.19.2'
  27. // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
  28. // Default run configurations.
  29. // These can be tweaked, removed, or duplicated as needed.
  30. runs {
  31. client {
  32. workingDirectory project.file('run')
  33. // Recommended logging data for a userdev environment
  34. // The markers can be added/remove as needed separated by commas.
  35. // "SCAN": For mods scan.
  36. // "REGISTRIES": For firing of registry events.
  37. // "REGISTRYDUMP": For getting the contents of all registries.
  38. property 'forge.logging.markers', 'REGISTRIES'
  39. // Recommended logging level for the console
  40. // You can set various levels here.
  41. // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  42. property 'forge.logging.console.level', 'debug'
  43. // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
  44. property 'forge.enabledGameTestNamespaces', 'examplemod'
  45. mods {
  46. examplemod {
  47. source sourceSets.main
  48. }
  49. }
  50. }
  51. server {
  52. workingDirectory project.file('run')
  53. property 'forge.logging.markers', 'REGISTRIES'
  54. property 'forge.logging.console.level', 'debug'
  55. property 'forge.enabledGameTestNamespaces', 'examplemod'
  56. mods {
  57. zry_client_utils_mod {
  58. source sourceSets.main
  59. }
  60. }
  61. }
  62. // This run config launches GameTestServer and runs all registered gametests, then exits.
  63. // By default, the server will crash when no gametests are provided.
  64. // The gametest system is also enabled by default for other run configs under the /test command.
  65. gameTestServer {
  66. workingDirectory project.file('run')
  67. property 'forge.logging.markers', 'REGISTRIES'
  68. property 'forge.logging.console.level', 'debug'
  69. property 'forge.enabledGameTestNamespaces', 'examplemod'
  70. mods {
  71. zry_client_utils_mod {
  72. source sourceSets.main
  73. }
  74. }
  75. }
  76. data {
  77. workingDirectory project.file('run')
  78. property 'forge.logging.markers', 'REGISTRIES'
  79. property 'forge.logging.console.level', 'debug'
  80. // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
  81. args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  82. mods {
  83. zry_client_utils_mod {
  84. source sourceSets.main
  85. }
  86. }
  87. }
  88. }
  89. }
  90. // Include resources generated by data generators.
  91. sourceSets.main.resources { srcDir 'src/generated/resources' }
  92. repositories {
  93. // Put repositories for dependencies here
  94. // ForgeGradle automatically adds the Forge maven and Maven Central for you
  95. // If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
  96. // flatDir {
  97. // dir 'libs'
  98. // }
  99. }
  100. dependencies {
  101. // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
  102. // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
  103. // The userdev artifact is a special name and will get all sorts of transformations applied to it.
  104. minecraft 'net.minecraftforge:forge:1.19.2-43.2.21'
  105. // Real mod deobf dependency examples - these get remapped to your current mappings
  106. // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
  107. // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
  108. // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
  109. // Examples using mod jars from ./libs
  110. // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
  111. // For more info...
  112. // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  113. // http://www.gradle.org/docs/current/userguide/dependency_management.html
  114. }
  115. // Example for how to get properties into the manifest for reading at runtime.
  116. jar {
  117. manifest {
  118. attributes([
  119. "Specification-Title" : "zry_client_utils_mod",
  120. "Specification-Vendor" : "ZRY",
  121. "Specification-Version" : "0.1.0", // We are version 1 of ourselves
  122. "Implementation-Title" : project.name,
  123. "Implementation-Version" : project.jar.archiveVersion,
  124. "Implementation-Vendor" : "ZRY",
  125. "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  126. ])
  127. }
  128. }
  129. // Example configuration to allow publishing using the maven-publish plugin
  130. // This is the preferred method to reobfuscate your jar file
  131. jar.finalizedBy('reobfJar')
  132. // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
  133. // publish.dependsOn('reobfJar')
  134. publishing {
  135. publications {
  136. mavenJava(MavenPublication) {
  137. artifact jar
  138. }
  139. }
  140. repositories {
  141. maven {
  142. url "file://${project.projectDir}/mcmodsrepo"
  143. }
  144. }
  145. }
  146. tasks.withType(JavaCompile).configureEach {
  147. options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
  148. }