Advertisement
Guest User

Untitled

a guest
Sep 13th, 2021
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 7.90 KB | None | 0 0
  1. buildscript {
  2.     repositories {
  3.         // These repositories are only for Gradle plugins, put any other repositories in the repository block further below
  4.         maven { url = 'https://maven.minecraftforge.net' }
  5.         mavenCentral()
  6.     }
  7.     dependencies {
  8.         classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
  9.     }
  10. }
  11. apply plugin: 'net.minecraftforge.gradle'
  12. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
  13. apply plugin: 'eclipse'
  14. apply plugin: 'maven-publish'
  15.  
  16. version = '1.17.1-1.0.4.0'
  17. group = 'com.madalchemist.zombienation' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  18. archivesBaseName = 'zombienation'
  19.  
  20. // Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16.
  21. java.toolchain.languageVersion = JavaLanguageVersion.of(16)
  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.     // The mappings can be changed at any time and must be in the following format.
  26.     // Channel:   Version:
  27.     // snapshot   YYYYMMDD   Snapshot are built nightly.
  28.     // stable     #          Stables are built at the discretion of the MCP team.
  29.     // official   MCVersion  Official field/method names from Mojang mapping files
  30.     //
  31.     // You must be aware of the Mojang license when using the 'official' mappings.
  32.     // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
  33.     //
  34.     // Use non-default mappings at your own risk. They may not always work.
  35.     // Simply re-run your setup task after changing the mappings to update your workspace.
  36.     //mappings channel: 'official', version: '1.16.5'
  37.     mappings channel: 'official', version: '1.17.1'
  38.     apply from: 'https://raw.githubusercontent.com/SizableShrimp/Forge-Class-Remapper/main/classremapper.gradle'
  39.     // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
  40.  
  41.     // Default run configurations.
  42.     // These can be tweaked, removed, or duplicated as needed.
  43.     runs {
  44.         client {
  45.             workingDirectory project.file('run')
  46.  
  47.             // Recommended logging data for a userdev environment
  48.             // The markers can be added/remove as needed separated by commas.
  49.             // "SCAN": For mods scan.
  50.             // "REGISTRIES": For firing of registry events.
  51.             // "REGISTRYDUMP": For getting the contents of all registries.
  52.             property 'forge.logging.markers', 'REGISTRIES'
  53.  
  54.             // Recommended logging level for the console
  55.             // You can set various levels here.
  56.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  57.             property 'forge.logging.console.level', 'debug'
  58.  
  59.             mods {
  60.                 zombienation {
  61.                     source sourceSets.main
  62.                 }
  63.             }
  64.         }
  65.  
  66.         server {
  67.             workingDirectory project.file('run')
  68.  
  69.             // Recommended logging data for a userdev environment
  70.             // The markers can be added/remove as needed separated by commas.
  71.             // "SCAN": For mods scan.
  72.             // "REGISTRIES": For firing of registry events.
  73.             // "REGISTRYDUMP": For getting the contents of all registries.
  74.             property 'forge.logging.markers', 'REGISTRIES'
  75.  
  76.             // Recommended logging level for the console
  77.             // You can set various levels here.
  78.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  79.             property 'forge.logging.console.level', 'debug'
  80.  
  81.             mods {
  82.                 zombienation {
  83.                     source sourceSets.main
  84.                 }
  85.             }
  86.         }
  87.  
  88.         data {
  89.             workingDirectory project.file('run')
  90.  
  91.             // Recommended logging data for a userdev environment
  92.             // The markers can be added/remove as needed separated by commas.
  93.             // "SCAN": For mods scan.
  94.             // "REGISTRIES": For firing of registry events.
  95.             // "REGISTRYDUMP": For getting the contents of all registries.
  96.             property 'forge.logging.markers', 'REGISTRIES'
  97.  
  98.             // Recommended logging level for the console
  99.             // You can set various levels here.
  100.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  101.             property 'forge.logging.console.level', 'debug'
  102.  
  103.             // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
  104.             args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  105.  
  106.             mods {
  107.                 zombienation {
  108.                     source sourceSets.main
  109.                 }
  110.             }
  111.         }
  112.     }
  113. }
  114.  
  115. // Include resources generated by data generators.
  116. sourceSets.main.resources { srcDir 'src/generated/resources' }
  117.  
  118. repositories {
  119.     // Put repositories for dependencies here
  120.     // ForgeGradle automatically adds the Forge maven and Maven Central for you
  121.  
  122.     // If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
  123.     // flatDir {
  124.     //     dir 'libs'
  125.     // }
  126. }
  127.  
  128. dependencies {
  129.     // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
  130.     // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
  131.     // The userdev artifact is a special name and will get all sorts of transformations applied to it.
  132.     minecraft 'net.minecraftforge:forge:1.17.1-37.0.59'
  133.  
  134.     // Real mod deobf dependency examples - these get remapped to your current mappings
  135.     // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
  136.     // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
  137.     // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
  138.  
  139.     // Examples using mod jars from ./libs
  140.     // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
  141.  
  142.     // For more info...
  143.     // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  144.     // http://www.gradle.org/docs/current/userguide/dependency_management.html
  145. }
  146.  
  147. // Example for how to get properties into the manifest for reading at runtime.
  148. jar {
  149.     manifest {
  150.         attributes([
  151.                 "Specification-Title"     : "zombienation",
  152.                 "Specification-Vendor"    : "Mad Alchemist",
  153.                 "Specification-Version"   : "1", // We are version 1 of ourselves
  154.                 "Implementation-Title"    : project.name,
  155.                 "Implementation-Version"  : project.jar.archiveVersion,
  156.                 "Implementation-Vendor"   : "Mad Alchemist",
  157.                 "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  158.         ])
  159.     }
  160. }
  161.  
  162. // Example configuration to allow publishing using the maven-publish plugin
  163. // This is the preferred method to reobfuscate your jar file
  164. jar.finalizedBy('reobfJar')
  165. // 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
  166. // publish.dependsOn('reobfJar')
  167.  
  168. publishing {
  169.     publications {
  170.         mavenJava(MavenPublication) {
  171.             artifact jar
  172.         }
  173.     }
  174.     repositories {
  175.         maven {
  176.             url "file://${project.projectDir}/mcmodsrepo"
  177.         }
  178.     }
  179. }
  180.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement