Guest User

build.gradle

a guest
Oct 14th, 2023
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.21 KB | Software | 0 0
  1. plugins {
  2. id 'eclipse'
  3. id 'idea'
  4. id 'maven-publish'
  5. id 'net.minecraftforge.gradle' version '[6.0,6.2)'
  6. id 'org.spongepowered.mixin' version '0.7.+'
  7. }
  8.  
  9. version = '1.20.2-1.0.0'
  10. group = 'yisusarj'
  11.  
  12. base {
  13. archivesName = 'healthywatermod'
  14. }
  15.  
  16. // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
  17. java.toolchain.languageVersion = JavaLanguageVersion.of(17)
  18.  
  19. println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
  20. minecraft {
  21.  
  22. mappings channel: mapping_channel, version: mapping_version
  23.  
  24. copyIdeResources = true
  25.  
  26. runs {
  27. configureEach {
  28. workingDirectory project.file('run')
  29. property 'forge.logging.markers', 'REGISTRIES'
  30. property 'forge.logging.console.level', 'debug'
  31. mods {
  32. "${mod_id}" {
  33. source sourceSets.main
  34. }
  35. }
  36. }
  37.  
  38. client {
  39. // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
  40. property 'forge.enabledGameTestNamespaces', mod_id
  41. }
  42.  
  43. server {
  44. property 'forge.enabledGameTestNamespaces', mod_id
  45. args '--nogui'
  46. }
  47. gameTestServer {
  48. property 'forge.enabledGameTestNamespaces', mod_id
  49. }
  50.  
  51. data {
  52. workingDirectory project.file('run-data')
  53. args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  54. }
  55. }
  56. }
  57.  
  58. // Include resources generated by data generators.
  59. sourceSets.main.resources { srcDir 'src/generated/resources' }
  60.  
  61. mixin {
  62. // MixinGradle Settings
  63. add sourceSets.main, 'mixins.healthywater.refmap.json'
  64. config 'mixins.healthywater.json'
  65. showMessageTypes = true
  66. }
  67.  
  68. repositories {
  69. }
  70.  
  71. dependencies {
  72. minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
  73. // Apply Mixin AP
  74. annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
  75. tasks.named('processResources', ProcessResources).configure {
  76. var replaceProperties = [
  77. minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
  78. forge_version: forge_version, forge_version_range: forge_version_range,
  79. loader_version_range: loader_version_range,
  80. mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
  81. mod_authors: mod_authors, mod_description: mod_description,
  82. ]
  83. inputs.properties replaceProperties
  84.  
  85. filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
  86. expand replaceProperties + [project: project]
  87. }
  88. }
  89.  
  90. // Example for how to get properties into the manifest for reading at runtime.
  91. tasks.named('jar', Jar).configure {
  92. manifest {
  93. attributes([
  94. 'Specification-Title' : mod_id,
  95. 'Specification-Vendor' : mod_authors,
  96. 'Specification-Version' : '1', // We are version 1 of ourselves
  97. 'Implementation-Title' : project.name,
  98. 'Implementation-Version' : project.jar.archiveVersion,
  99. 'Implementation-Vendor' : mod_authors,
  100. 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  101. ])
  102. }
  103.  
  104. // This is the preferred method to reobfuscate your jar file
  105. finalizedBy 'reobfJar'
  106. }
  107.  
  108. // 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:
  109. // tasks.named('publish').configure {
  110. // dependsOn 'reobfJar'
  111. // }
  112.  
  113. // Example configuration to allow publishing using the maven-publish plugin
  114. publishing {
  115. publications {
  116. register('mavenJava', MavenPublication) {
  117. artifact jar
  118. }
  119. }
  120. repositories {
  121. maven {
  122. url "file://${project.projectDir}/mcmodsrepo"
  123. }
  124. }
  125. }
  126.  
  127. tasks.withType(JavaCompile).configureEach {
  128. options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
  129. }
  130.  
Advertisement
Add Comment
Please, Sign In to add comment