Advertisement
Iunius

build.gradle (1.19.2 ForgeでMixin、JEI、TOP使用)

Aug 31st, 2022 (edited)
3,037
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 4.14 KB | Source Code | 0 0
  1. buildscript {
  2.     dependencies {
  3.         // MixinGradle:
  4.         classpath 'org.spongepowered:mixingradle:0.7.+'
  5.     }
  6. }
  7.  
  8. plugins {
  9.     id 'eclipse'
  10.     id 'maven-publish'
  11.     id 'net.minecraftforge.gradle' version '5.1.+'
  12. }
  13.  
  14. // MixinGradle:
  15. apply plugin: 'org.spongepowered.mixin'
  16.  
  17. version = '1.0'
  18. group = 'com.yourname.modid'
  19. archivesBaseName = 'modid'
  20.  
  21. java.toolchain.languageVersion = JavaLanguageVersion.of(17)
  22.  
  23. println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
  24. minecraft {
  25.     mappings channel: "official", version: "1.19.2"
  26.  
  27.     runs {
  28.         client {
  29.             workingDirectory project.file('run')
  30.             property 'forge.logging.markers', 'REGISTRIES'
  31.             property 'forge.logging.console.level', 'debug'
  32.             property 'forge.enabledGameTestNamespaces', 'examplemod'
  33.  
  34.             mods {
  35.                 examplemod {
  36.                     source sourceSets.main
  37.                 }
  38.             }
  39.         }
  40.  
  41.         server {
  42.             workingDirectory project.file('run')
  43.             property 'forge.logging.markers', 'REGISTRIES'
  44.             property 'forge.logging.console.level', 'debug'
  45.             property 'forge.enabledGameTestNamespaces', 'examplemod'
  46.  
  47.             mods {
  48.                 examplemod {
  49.                     source sourceSets.main
  50.                 }
  51.             }
  52.         }
  53.  
  54.         gameTestServer {
  55.             workingDirectory project.file('run')
  56.             property 'forge.logging.markers', 'REGISTRIES'
  57.             property 'forge.logging.console.level', 'debug'
  58.             property 'forge.enabledGameTestNamespaces', 'examplemod'
  59.  
  60.             mods {
  61.                 examplemod {
  62.                     source sourceSets.main
  63.                 }
  64.             }
  65.         }
  66.  
  67.         data {
  68.             workingDirectory project.file('run')
  69.             property 'forge.logging.markers', 'REGISTRIES'
  70.             property 'forge.logging.console.level', 'debug'
  71.             args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  72.  
  73.             mods {
  74.                 examplemod {
  75.                     source sourceSets.main
  76.                 }
  77.             }
  78.         }
  79.     }
  80. }
  81.  
  82. sourceSets.main.resources { srcDir 'src/generated/resources' }
  83.  
  84. mixin {
  85.     // MixinGradle Settings
  86.     add sourceSets.main, 'mixins.examplemod.refmap.json'
  87.     config 'mixins.examplemod.json'
  88.  
  89.     debug.verbose = true
  90.     debug.export = true
  91. }
  92.  
  93. repositories {
  94.     maven {
  95.         // JEI
  96.         url "https://dvs1.progwml6.com/files/maven/"
  97.     }
  98.     maven {
  99.         // TOP
  100.         url "https://maven.k-4u.nl"
  101.     }
  102. }
  103.  
  104. dependencies {
  105.     minecraft "net.minecraftforge:forge:1.19.2-43.1.1"
  106.     // Apply Mixin AP
  107.     annotationProcessor "org.spongepowered:mixin:0.8.5:processor"
  108.     // JEI
  109.     compileOnly fg.deobf("mezz.jei:jei-1.19.2-common-api:11.2.0.256")
  110.     compileOnly fg.deobf("mezz.jei:jei-1.19.2-forge-api:11.2.0.256")
  111.     runtimeOnly fg.deobf("mezz.jei:jei-1.19.2-forge:11.2.0.256")
  112.     // TOP
  113.     implementation fg.deobf(project.dependencies.create("mcjty.theoneprobe:theoneprobe:1.19-6.2.0-6") {
  114.         transitive = false
  115.     })
  116. }
  117.  
  118. jar {
  119.     manifest {
  120.         attributes([
  121.                 "Specification-Title"     : "examplemod",
  122.                 "Specification-Vendor"    : "examplemodsareus",
  123.                 "Specification-Version"   : "1",
  124.                 "Implementation-Title"    : project.name,
  125.                 "Implementation-Version"  : project.jar.archiveVersion,
  126.                 "Implementation-Vendor"   : "examplemodsareus",
  127.                 "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  128.         ])
  129.     }
  130. }
  131.  
  132. jar.finalizedBy('reobfJar')
  133.  
  134. publishing {
  135.     publications {
  136.         mavenJava(MavenPublication) {
  137.             artifact jar
  138.         }
  139.     }
  140.     repositories {
  141.         maven {
  142.             url "file://${project.projectDir}/mcmodsrepo"
  143.         }
  144.     }
  145. }
  146.  
  147. tasks.withType(JavaCompile).configureEach {
  148.     options.encoding = 'UTF-8'
  149. }
  150.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement