Advertisement
4ny

buid.gradle

4ny
Jun 29th, 2023
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 7.59 KB | None | 0 0
  1. buildscript {
  2.     repositories {
  3.         maven { url = 'https://maven.minecraftforge.net' }
  4.         mavenCentral()
  5.     }
  6.     dependencies {
  7.         classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
  8.         //classpath group: 'software.bernie.geckolib', name: 'geckolib-forge-1.16.5', version: '3.0.106'
  9.     }
  10. }
  11.  
  12. apply plugin: 'net.minecraftforge.gradle'
  13. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
  14. apply plugin: 'eclipse'
  15. apply plugin: 'maven-publish'
  16.  
  17. version = '1.16.5-0.1'
  18. group = 'com.any.testmod' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  19. archivesBaseName = 'testmod'
  20.  
  21. java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
  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: 'snapshot', version: '20210309-1.16.5'
  37.     // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
  38.    
  39.     // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  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 changed as needed.
  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.                 testmod {
  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 changed as needed.
  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.                 testmod {
  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 changed as needed.
  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', 'testmod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  105.  
  106.             mods {
  107.                 testmod {
  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. dependencies {
  119.     // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
  120.     // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
  121.     // The userdev artifact is a special name and will get all sorts of transformations applied to it.
  122.     minecraft 'net.minecraftforge:forge:1.16.5-36.2.34'
  123.  
  124.     // You may put jars on which you depend on in ./libs or you may define them like so..
  125.     // compile "some.group:artifact:version:classifier"
  126.     // compile "some.group:artifact:version"
  127.  
  128.     // Real examples
  129.     // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
  130.     // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
  131.  
  132.     // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
  133.     // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  134.  
  135.     // These dependencies get remapped to your current MCP mappings
  136.     // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  137.  
  138.     // For more info...
  139.     // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  140.     // http://www.gradle.org/docs/current/userguide/dependency_management.html
  141.  
  142. }
  143.  
  144. // Example for how to get properties into the manifest for reading by the runtime..
  145. jar {
  146.     manifest {
  147.         attributes([
  148.             "Specification-Title": "testmod",
  149.             "Specification-Vendor": "testmodsareus",
  150.             "Specification-Version": "1", // We are version 1 of ourselves
  151.             "Implementation-Title": project.name,
  152.             "Implementation-Version": "${version}",
  153.             "Implementation-Vendor" :"testmodsareus",
  154.             "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  155.         ])
  156.     }
  157. }
  158.  
  159. // Example configuration to allow publishing using the maven-publish task
  160. // This is the preferred method to reobfuscate your jar file
  161. jar.finalizedBy('reobfJar')
  162. // 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
  163. //publish.dependsOn('reobfJar')
  164.  
  165. publishing {
  166.     publications {
  167.         mavenJava(MavenPublication) {
  168.             artifact jar
  169.         }
  170.     }
  171.     repositories {
  172.         maven {
  173.  
  174.         }
  175.     }
  176. }
  177.  
  178. //Geckolib dependency
  179.  
  180. repositories {
  181.     maven {
  182.         name = 'GeckoLib'
  183.         url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/'
  184.     }
  185. }
  186.  
  187. dependencies {
  188.     implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.16:3.0.100')
  189. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement