Advertisement
jayhillx

build.gradle

Jul 7th, 2023
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. buildscript {
  2. repositories {
  3. maven { url = 'https://maven.minecraftforge.net' }
  4. maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
  5. }
  6. dependencies {
  7. classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '[6.0,6.2)', changing: true
  8. classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
  9. }
  10. }
  11.  
  12. plugins {
  13. id 'eclipse'
  14. id 'maven-publish'
  15. }
  16. apply plugin: 'net.minecraftforge.gradle'
  17. apply plugin: 'org.spongepowered.mixin'
  18.  
  19. version = mod_version
  20. group = mod_group_id
  21. base {
  22. archivesName = mod_id
  23. }
  24.  
  25. java.toolchain.languageVersion = JavaLanguageVersion.of(17)
  26.  
  27. minecraft {
  28. mappings channel: mapping_channel, version: mapping_version
  29.  
  30. accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  31.  
  32. runs {
  33. configureEach {
  34. workingDirectory project.file('run')
  35. property 'forge.logging.markers', 'REGISTRIES'
  36. property 'forge.logging.console.level', 'debug'
  37.  
  38. mods {
  39. "${mod_id}" {
  40. source sourceSets.main
  41. }
  42. }
  43. }
  44.  
  45. client {
  46. property 'forge.enabledGameTestNamespaces', mod_id
  47. }
  48.  
  49. data {
  50. workingDirectory project.file('run-data')
  51. args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  52. }
  53. }
  54. }
  55.  
  56. sourceSets.main.resources {
  57. srcDir 'src/generated/resources'
  58. }
  59.  
  60. dependencies {
  61. minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
  62.  
  63. implementation fg.deobf("com.github.glitchfiend:TerraBlender-forge:${terrablender_version}")
  64. }
  65.  
  66. tasks.named('processResources', ProcessResources).configure {
  67. var replaceProperties = [
  68. minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
  69. forge_version: forge_version, forge_version_range: forge_version_range,
  70. loader_version_range: loader_version_range,
  71. mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
  72. mod_authors: mod_authors, mod_description: mod_description,
  73. ]
  74. inputs.properties replaceProperties
  75.  
  76. filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
  77. expand replaceProperties + [project: project]
  78. }
  79. }
  80.  
  81. tasks.named('jar', Jar).configure {
  82. manifest {
  83. attributes([
  84. 'Specification-Title' : mod_id,
  85. 'Specification-Vendor' : mod_authors,
  86. 'Specification-Version' : '1',
  87. 'Implementation-Title' : project.name,
  88. 'Implementation-Version' : project.jar.archiveVersion,
  89. 'Implementation-Vendor' : mod_authors,
  90. 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  91. ])
  92. }
  93. }
  94.  
  95. publishing {
  96. publications {
  97. register('mavenJava', MavenPublication) {
  98. artifact jar
  99. }
  100. }
  101. repositories {
  102. maven {
  103. url "file://${project.projectDir}/mcmodsrepo"
  104. }
  105. }
  106. }
  107.  
  108. tasks.withType(JavaCompile).configureEach {
  109. options.encoding = 'UTF-8'
  110. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement