Advertisement
Scouter456

Untitled

Aug 9th, 2023
1,028
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 8.07 KB | None | 0 0
  1. plugins {
  2.     id 'eclipse'
  3.     id 'maven-publish'
  4.     id 'net.minecraftforge.gradle' version '[6.0,6.2)'
  5.     id 'org.parchmentmc.librarian.forgegradle' version '1.+'
  6.     id 'org.spongepowered.mixin' version '0.7-SNAPSHOT' apply(true)
  7. }
  8.  
  9. version = '0.3-1.20.1'
  10. group = 'net.cinchtail.cinchcraft' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  11. archivesBaseName = 'cinchcraft'
  12.  
  13. // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
  14. java.toolchain.languageVersion = JavaLanguageVersion.of(17)
  15.  
  16. println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
  17. minecraft {
  18.     // The mappings can be changed at any time and must be in the following format.
  19.     // Channel:   Version:
  20.     // official   MCVersion             Official field/method names from Mojang mapping files
  21.     // parchment  YYYY.MM.DD-MCVersion  Open community-sourced parameter names and javadocs layered on top of official
  22.     //
  23.     // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
  24.     // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
  25.     //
  26.     // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
  27.     // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
  28.     //
  29.     // Use non-default mappings at your own risk. They may not always work.
  30.     // Simply re-run your setup task after changing the mappings to update your workspace.
  31.     mappings channel: 'official', version: '1.20.1'
  32.  
  33.     accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  34.  
  35.     // Default run configurations.
  36.     // These can be tweaked, removed, or duplicated as needed.
  37.     runs {
  38.         client {
  39.             workingDirectory project.file('run')
  40.  
  41.             arg '-mixin.config=cinchcraft.mixins.json'
  42.             // Recommended logging data for a userdev environment
  43.             // The markers can be added/remove as needed separated by commas.
  44.             // "SCAN": For mods scan.
  45.             // "REGISTRIES": For firing of registry events.
  46.             // "REGISTRYDUMP": For getting the contents of all registries.
  47.             property 'forge.logging.markers', 'REGISTRIES'
  48.  
  49.             // Recommended logging level for the console
  50.             // You can set various levels here.
  51.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  52.             property 'forge.logging.console.level', 'debug'
  53.  
  54.             // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
  55.             property 'forge.enabledGameTestNamespaces', 'cinchcraft'
  56.  
  57.             mods {
  58.                 cinchcraft {
  59.                     source sourceSets.main
  60.                 }
  61.             }
  62.         }
  63.  
  64.         server {
  65.             workingDirectory project.file('run')
  66.             arg '-mixin.config=cinchcraft.mixins.json'
  67.  
  68.             property 'forge.logging.markers', 'REGISTRIES'
  69.  
  70.             property 'forge.logging.console.level', 'debug'
  71.  
  72.             property 'forge.enabledGameTestNamespaces', 'cinchcraft'
  73.  
  74.             mods {
  75.                 cinchcraft {
  76.                     source sourceSets.main
  77.                 }
  78.             }
  79.         }
  80.  
  81.         // This run config launches GameTestServer and runs all registered gametests, then exits.
  82.         // By default, the server will crash when no gametests are provided.
  83.         // The gametest system is also enabled by default for other run configs under the /test command.
  84.         gameTestServer {
  85.             workingDirectory project.file('run')
  86.  
  87.             property 'forge.logging.markers', 'REGISTRIES'
  88.  
  89.             property 'forge.logging.console.level', 'debug'
  90.  
  91.             property 'forge.enabledGameTestNamespaces', 'cinchcraft'
  92.  
  93.             mods {
  94.                 cinchcraft {
  95.                     source sourceSets.main
  96.                 }
  97.             }
  98.         }
  99.  
  100.         data {
  101.             workingDirectory project.file('run')
  102.  
  103.             property 'forge.logging.markers', 'REGISTRIES'
  104.  
  105.             property 'forge.logging.console.level', 'debug'
  106.  
  107.             // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
  108.             args '--mod', 'cinchcraft', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  109.  
  110.             mods {
  111.                 cinchcraft {
  112.                     source sourceSets.main
  113.                 }
  114.             }
  115.         }
  116.     }
  117. }
  118.  
  119. // Include resources generated by data generators.
  120. sourceSets.main.resources { srcDir 'src/generated/resources' }
  121.  
  122. repositories {
  123.     // Put repositories for dependencies here
  124.     // ForgeGradle automatically adds the Forge maven and Maven Central for you
  125.  
  126.     // If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
  127.     // flatDir {
  128.     //     dir 'libs'
  129.     // }
  130.     maven {
  131.         // location of the maven that hosts JEI files since January 2023
  132.         name = "Jared's maven"
  133.         url = "https://maven.blamejared.com/"
  134.     }
  135. }
  136.  
  137. mixin {
  138.     add sourceSets.main, "cinchcraft.refmap.json"
  139. }
  140.  
  141. dependencies {
  142.     // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
  143.     // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
  144.     // The userdev artifact is a special name and will get all sorts of transformations applied to it.
  145.     minecraft 'net.minecraftforge:forge:1.20.1-47.1.3'
  146.     annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
  147.  
  148.     // compile against the JEI API but do not include it at runtime
  149.     compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"))
  150.     compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}"))
  151.     // at runtime, use the full JEI jar for Forge
  152.     runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
  153.  
  154.     // Real mod deobf dependency examples - these get remapped to your current mappings
  155.     // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
  156.  
  157.     // Examples using mod jars from ./libs
  158.     // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
  159.  
  160.     // For more info...
  161.     // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  162.     // http://www.gradle.org/docs/current/userguide/dependency_management.html
  163. }
  164.  
  165. // Example for how to get properties into the manifest for reading at runtime.
  166. jar {
  167.     manifest {
  168.         attributes([
  169.                 "Specification-Title"     : "cinchcraft",
  170.                 "Specification-Vendor"    : "cinchtail",
  171.                 "Specification-Version"   : "1", // We are version 1 of ourselves
  172.                 "Implementation-Title"    : project.name,
  173.                 "Implementation-Version"  : project.jar.archiveVersion,
  174.                 "Implementation-Vendor"   : "cinchtail",
  175.                 "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
  176.                 "MixinConfigs"            : "cinchcraft.mixins.json"
  177.         ])
  178.     }
  179. }
  180.  
  181. // Example configuration to allow publishing using the maven-publish plugin
  182. // This is the preferred method to reobfuscate your jar file
  183. jar.finalizedBy('reobfJar')
  184. // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
  185. // publish.dependsOn('reobfJar')
  186.  
  187. publishing {
  188.     publications {
  189.         mavenJava(MavenPublication) {
  190.             artifact jar
  191.         }
  192.     }
  193.     repositories {
  194.         maven {
  195.             url "file://${project.projectDir}/mcmodsrepo"
  196.         }
  197.     }
  198. }
  199.  
  200. tasks.withType(JavaCompile).configureEach {
  201.     options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
  202. }
  203.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement