Guest User

build.gradle

a guest
Jan 3rd, 2026
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. plugins {
  2. id 'fabric-loom' version '1.14-SNAPSHOT'
  3. id 'maven-publish'
  4. }
  5.  
  6. version = project.mod_version
  7. group = project.maven_group
  8.  
  9. base {
  10. archivesName = project.archives_base_name
  11. }
  12.  
  13. loom {
  14. splitEnvironmentSourceSets()
  15.  
  16. mods {
  17. "forecast" {
  18. sourceSet sourceSets.main
  19. sourceSet sourceSets.client
  20. }
  21. }
  22. }
  23.  
  24. fabricApi {
  25. configureDataGeneration {
  26. client = true
  27. }
  28. }
  29.  
  30. repositories {
  31. // Add repositories to retrieve artifacts from in here.
  32. // You should only use this when depending on other mods because
  33. // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
  34. // See https://docs.gradle.org/current/userguide/declaring_repositories.html
  35. // for more information about repositories.
  36. }
  37.  
  38. dependencies {
  39. // To change the versions see the gradle.properties file
  40. minecraft "com.mojang:minecraft:${project.minecraft_version}"
  41. mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
  42. modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
  43.  
  44. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
  45. }
  46.  
  47. processResources {
  48. inputs.property "version", project.version
  49. inputs.property "minecraft_version", project.minecraft_version
  50. inputs.property "loader_version", project.loader_version
  51. filteringCharset "UTF-8"
  52.  
  53. filesMatching("fabric.mod.json") {
  54. expand "version": project.version,
  55. "minecraft_version": project.minecraft_version,
  56. "loader_version": project.loader_version
  57. }
  58. }
  59.  
  60. def targetJavaVersion = 21
  61. tasks.withType(JavaCompile).configureEach {
  62. // ensure that the encoding is set to UTF-8, no matter what the system default is
  63. // this fixes some edge cases with special characters not displaying correctly
  64. // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
  65. // If Javadoc is generated, this must be specified in that task too.
  66. it.options.encoding = "UTF-8"
  67. if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
  68. it.options.release.set(targetJavaVersion)
  69. }
  70. }
  71.  
  72. java {
  73. def javaVersion = JavaVersion.toVersion(targetJavaVersion)
  74. if (JavaVersion.current() < javaVersion) {
  75. toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
  76. }
  77. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  78. // if it is present.
  79. // If you remove this line, sources will not be generated.
  80. withSourcesJar()
  81. }
  82.  
  83. jar {
  84. from("LICENSE") {
  85. rename { "${it}_${project.archivesBaseName}" }
  86. }
  87. }
  88.  
  89. // configure the maven publication
  90. publishing {
  91. publications {
  92. create("mavenJava", MavenPublication) {
  93. artifactId = project.archives_base_name
  94. from components.java
  95. }
  96. }
  97.  
  98. // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
  99. repositories {
  100. // Add repositories to publish to here.
  101. // Notice: This block does NOT have the same function as the block in the top level.
  102. // The repositories here will be used for publishing your artifact, not for
  103. // retrieving dependencies.
  104. }
  105. }
  106.  
Advertisement
Add Comment
Please, Sign In to add comment