build.gradle.kts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import net.minecraftforge.gradle.user.UserBaseExtension
  2. import Config.Libs.Sponge.API7 as API7
  3. buildscript {
  4. repositories {
  5. jcenter()
  6. maven(Repos.forge)
  7. }
  8. dependencies {
  9. classpath(Plugins.FG2_3.classpath)
  10. }
  11. }
  12. // Extension created to set up the minecraft block for ForgeGradle. This should change in FG3.
  13. val Project.minecraft: UserBaseExtension
  14. get() = extensions.getByName<UserBaseExtension>(Plugins.FG2_3.extensionName)
  15. plugins {
  16. `java-library`
  17. // Apply the spongegradle plugin to generate the metadata file
  18. id(Config.Libs.Sponge.API7.spongeGradleId) version Config.Libs.Sponge.API7.spongeGradleVersion // supplies sponge repo and plugin metadata creation tasks
  19. }
  20. apply(plugin = API7.forgeGradleId)
  21. dependencies {
  22. compileOnly(API7.api) // SpongeAPI
  23. }
  24. configure<UserBaseExtension> {
  25. version = API7.minecraftVersion
  26. runDir = "run"
  27. mappings = API7.mappings
  28. }
  29. tasks.withType<Jar> {
  30. inputs.properties += "version" to project.version
  31. inputs.properties += "mcversion" to project.minecraft.version
  32. baseName = "mcmmo"
  33. filesMatching("/mcmod.info") {
  34. expand(mapOf(
  35. "version" to project.version,
  36. "mcversion" to project.minecraft.version
  37. ))
  38. }
  39. }