Advertisement
Guest User

build.gradle.kts

a guest
Mar 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 2.64 KB | None | 0 0
  1. import net.minecraftforge.gradle.userdev.UserDevExtension
  2. import net.minecraftforge.gradle.userdev.UserDevPlugin
  3. import java.time.ZonedDateTime
  4. import java.time.ZoneOffset
  5. import java.time.format.DateTimeFormatter
  6.  
  7. buildscript {
  8.     repositories {
  9.         maven { setUrl("https://files.minecraftforge.net/maven") }
  10.         jcenter()
  11.         mavenCentral()
  12.     }
  13.     dependencies {
  14.         classpath("net.minecraftforge.gradle:ForgeGradle:3.+")
  15.     }
  16. }
  17.  
  18. apply {
  19.     plugin<UserDevPlugin>()
  20.     plugin("eclipse")
  21. }
  22.  
  23. version = "1.0"
  24. group = "com.yourname.modid"
  25. configure<BasePluginConvention> {
  26.     archivesBaseName = "modid"
  27. }
  28.  
  29. repositories {
  30.     mavenCentral()
  31. }
  32.  
  33. configure<JavaPluginConvention> {
  34.     sourceCompatibility = JavaVersion.VERSION_1_8
  35.     targetCompatibility = JavaVersion.VERSION_1_8
  36. }
  37.  
  38. fun minecraft(configure: UserDevExtension.() -> Unit) = project.configure(configure)
  39.  
  40. minecraft {
  41.  
  42.     mappings("snapshot", "20180921-1.13")
  43.  
  44.     runs {
  45.         "client" {
  46.             workingDirectory(project.file("run"))
  47.  
  48.             // Recommended logging data for a userdev environment
  49.             property("forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP")
  50.  
  51.             // Recommended logging level for the console
  52.             property("forge.logging.console.level", "debug")
  53.  
  54.             mods {
  55.                 "examplemod" {
  56.                     source(project.the<JavaPluginConvention>().sourceSets["main"])
  57.                 }
  58.             }
  59.         }
  60.  
  61.         "server" {
  62.             workingDirectory(project.file("run"))
  63.  
  64.             // Recommended logging data for a userdev environment
  65.             property("forge.logging.markers", "SCAN,REGISTRIES,REGISTRYDUMP")
  66.  
  67.             // Recommended logging level for the console
  68.             property("forge.logging.console.level", "debug")
  69.  
  70.             mods {
  71.                 "examplemod" {
  72.                     source(project.the<JavaPluginConvention>().sourceSets["main"])
  73.                 }
  74.             }
  75.         }
  76.     }
  77. }
  78.  
  79. dependencies {
  80.     "minecraft"("net.minecraftforge:forge:1.13.2-25.0.74")
  81. }
  82.  
  83. configure<JavaPluginConvention> {
  84.     manifest {
  85.         attributes(mapOf(
  86.                 "Specification-Title" to "examplemod",
  87.                 "Specification-Vendor" to "examplemodsareus",
  88.                 "Specification-Version" to "1",
  89.                 "Implementation-Title" to project.name,
  90.                 "Implementation-Version" to "$version",
  91.                 "Implementation-Vendor" to "examplemodsareus",
  92.                 "Implementation-Timestamp" to ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT)
  93.         ))
  94.     }
  95. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement