build.gradle 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. buildscript {
  2. repositories {
  3. maven { url = 'https://files.minecraftforge.net/maven' }
  4. jcenter()
  5. mavenCentral()
  6. }
  7. dependencies {
  8. classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
  9. }
  10. }
  11. apply plugin: 'net.minecraftforge.gradle'
  12. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
  13. apply plugin: 'eclipse'
  14. apply plugin: 'maven-publish'
  15. version = '1.0'
  16. group = 'com.hexdragon.blacksmithre' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  17. archivesBaseName = 'blacksmithre'
  18. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
  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. // The mappings can be changed at any time, and must be in the following format.
  22. // snapshot_YYYYMMDD Snapshot are built nightly.
  23. // stable_# Stables are built at the discretion of the MCP team.
  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: 'snapshot', version: '20201028-1.16.3'
  27. // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
  28. // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  29. // Default run configurations.
  30. // These can be tweaked, removed, or duplicated as needed.
  31. runs {
  32. client {
  33. workingDirectory project.file('run')
  34. // Recommended logging data for a userdev environment
  35. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  36. // Recommended logging level for the console
  37. property 'forge.logging.console.level', 'info'
  38. mods {
  39. examplemod {
  40. source sourceSets.main
  41. }
  42. }
  43. }
  44. server {
  45. workingDirectory project.file('run')
  46. // Recommended logging data for a userdev environment
  47. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  48. // Recommended logging level for the console
  49. property 'forge.logging.console.level', 'debug'
  50. mods {
  51. examplemod {
  52. source sourceSets.main
  53. }
  54. }
  55. }
  56. data {
  57. workingDirectory project.file('run')
  58. // Recommended logging data for a userdev environment
  59. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  60. // Recommended logging level for the console
  61. property 'forge.logging.console.level', 'debug'
  62. // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
  63. args '--mod', 'blacksmithre', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  64. mods {
  65. examplemod {
  66. source sourceSets.main
  67. }
  68. }
  69. }
  70. }
  71. }
  72. // Include resources generated by data generators.
  73. sourceSets.main.resources { srcDir 'src/generated/resources' }
  74. dependencies {
  75. // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
  76. // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
  77. // The userdev artifact is a special name and will get all sorts of transformations applied to it.
  78. minecraft 'net.minecraftforge:forge:1.16.3-34.1.42'
  79. // You may put jars on which you depend on in ./libs or you may define them like so..
  80. // compile "some.group:artifact:version:classifier"
  81. // compile "some.group:artifact:version"
  82. // Real examples
  83. // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
  84. // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
  85. // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
  86. // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  87. // These dependencies get remapped to your current MCP mappings
  88. // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  89. // For more info...
  90. // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  91. // http://www.gradle.org/docs/current/userguide/dependency_management.html
  92. }
  93. // Example for how to get properties into the manifest for reading by the runtime..
  94. jar {
  95. manifest {
  96. attributes([
  97. "Specification-Title": "blacksmithre",
  98. "Specification-Vendor": "blacksmithrev",
  99. "Specification-Version": "1", // We are version 1 of ourselves
  100. "Implementation-Title": project.name,
  101. "Implementation-Version": "${version}",
  102. "Implementation-Vendor" :"blacksmithrev",
  103. "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  104. ])
  105. }
  106. }
  107. // Example configuration to allow publishing using the maven-publish task
  108. // This is the preferred method to reobfuscate your jar file
  109. jar.finalizedBy('reobfJar')
  110. // 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
  111. //publish.dependsOn('reobfJar')
  112. publishing {
  113. publications {
  114. mavenJava(MavenPublication) {
  115. artifact jar
  116. }
  117. }
  118. repositories {
  119. maven {
  120. url "file:///${project.projectDir}/mcmodsrepo"
  121. }
  122. }
  123. }
  124. tasks.withType(JavaCompile) {
  125. options.encoding = "UTF-8"
  126. }