build.gradle 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. import java.util.stream.Collectors
  2. import net.minecraftforge.gradle.common.task.SignJar
  3. buildscript {
  4. repositories {
  5. maven { url = 'https://files.minecraftforge.net/maven' }
  6. jcenter()
  7. mavenCentral()
  8. maven {url='https://dist.creeper.host/Sponge/maven'}
  9. }
  10. dependencies {
  11. classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
  12. classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
  13. }
  14. }
  15. apply plugin: 'net.minecraftforge.gradle'
  16. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
  17. apply plugin: 'eclipse'
  18. apply plugin: 'maven-publish'
  19. version = "${mod_version}"
  20. group = "malte0811.${modid}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  21. archivesBaseName = "${modid}"
  22. def mixinConfigs = ["predicates", "fastmap", "nopropertymap", "mrl"].stream()
  23. .map({s -> archivesBaseName+"."+s+".mixin.json"})
  24. .collect(Collectors.toList())
  25. def mixinConfigArg = mixinConfigs.stream()
  26. .map({s -> "-mixin.config="+s})
  27. .collect(Collectors.toList())
  28. def mixinConfigManifestEntry = mixinConfigs.join(",");
  29. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
  30. minecraft {
  31. // The mappings can be changed at any time, and must be in the following format.
  32. // snapshot_YYYYMMDD Snapshot are built nightly.
  33. // stable_# Stables are built at the discretion of the MCP team.
  34. // Use non-default mappings at your own risk. they may not always work.
  35. // Simply re-run your setup task after changing the mappings to update your workspace.
  36. mappings channel: "snapshot", version: "${mapping}-${mcp_version}"
  37. // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
  38. //accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  39. // Default run configurations.
  40. // These can be tweaked, removed, or duplicated as needed.
  41. runs {
  42. client {
  43. workingDirectory project.file('run')
  44. args mixinConfigArg
  45. property 'mixin.env.disableRefMap', 'true'
  46. property 'mixin.debug.export', 'true'
  47. // Recommended logging level for the console
  48. property 'forge.logging.console.level', 'debug'
  49. mods {
  50. examplemod {
  51. source sourceSets.main
  52. }
  53. }
  54. }
  55. server {
  56. workingDirectory project.file('run')
  57. args mixinConfigArg
  58. arg "-nogui"
  59. property 'mixin.env.disableRefMap', 'true'
  60. // Recommended logging level for the console
  61. property 'forge.logging.console.level', 'debug'
  62. mods {
  63. examplemod {
  64. source sourceSets.main
  65. }
  66. }
  67. }
  68. }
  69. }
  70. def customGradle = rootProject.file('custom.gradle');
  71. if (customGradle.exists()) {
  72. apply from: customGradle;
  73. }
  74. repositories{
  75. maven {
  76. // location of the maven that hosts JEI files
  77. name = "Progwml6 maven"
  78. url = "https://dvs1.progwml6.com/files/maven/"
  79. }
  80. maven {
  81. // location of a maven mirror for JEI files, as a fallback
  82. name = "ModMaven"
  83. url = "https://modmaven.k-4u.nl"
  84. }
  85. maven {
  86. name = "BlameJared"
  87. url = "https://maven.blamejared.com/"
  88. }
  89. jcenter()
  90. mavenCentral()
  91. }
  92. dependencies {
  93. minecraft "net.minecraftforge:forge:${mc_version}-${forge_version}"
  94. runtimeOnly fg.deobf("mezz.jei:jei-1.16.3:7.6.0.49")
  95. }
  96. // Example for how to get properties into the manifest for reading by the runtime..
  97. jar {
  98. manifest {
  99. attributes([
  100. "Specification-Title": "${modid}",
  101. "Specification-Version": "1", // We are version 1 of ourselves
  102. "Implementation-Title": project.name,
  103. "Implementation-Version": "${version}",
  104. "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
  105. "MixinConfigs": mixinConfigManifestEntry
  106. ])
  107. }
  108. }
  109. apply plugin: 'org.spongepowered.mixin'
  110. task signJar(type: SignJar, dependsOn: jar) {
  111. onlyIf {
  112. project.hasProperty('keyStore')
  113. }
  114. if (project.hasProperty('keyStore')) {
  115. keyStore = project.keyStore
  116. alias = project.storeAlias
  117. storePass = project.storePass
  118. keyPass = project.storePass
  119. inputFile = jar.archivePath
  120. outputFile = jar.archivePath
  121. } else {
  122. logger.warn("No key store found, not signing the output jar\n")
  123. }
  124. }
  125. build.dependsOn signJar
  126. mixin {
  127. add sourceSets.main, "${modid}.refmap.json"
  128. }