Advertisement
4ny

Untitled

4ny
Jun 29th, 2023
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 7.43 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.     }
  9. }
  10. apply plugin: 'net.minecraftforge.gradle'
  11. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
  12. apply plugin: 'eclipse'
  13. apply plugin: 'maven-publish'
  14.  
  15. version = '1.16.5-0.1'
  16. group = 'com.any.testmod' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  17. archivesBaseName = 'testmod'
  18.  
  19. java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
  20.  
  21. println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
  22. minecraft {
  23.     // The mappings can be changed at any time, and must be in the following format.
  24.     // Channel:   Version:
  25.     // snapshot   YYYYMMDD   Snapshot are built nightly.
  26.     // stable     #          Stables are built at the discretion of the MCP team.
  27.     // official   MCVersion  Official field/method names from Mojang mapping files
  28.     //
  29.     // You must be aware of the Mojang license when using the 'official' mappings.
  30.     // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
  31.     //
  32.     // Use non-default mappings at your own risk. they may not always work.
  33.     // Simply re-run your setup task after changing the mappings to update your workspace.
  34.     mappings channel: 'snapshot', version: '20210309-1.16.5'
  35.     // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
  36.    
  37.     // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  38.  
  39.     // Default run configurations.
  40.     // These can be tweaked, removed, or duplicated as needed.
  41.     runs {
  42.         client {
  43.             workingDirectory project.file('run')
  44.  
  45.             // Recommended logging data for a userdev environment
  46.             // The markers can be changed as needed.
  47.             // "SCAN": For mods scan.
  48.             // "REGISTRIES": For firing of registry events.
  49.             // "REGISTRYDUMP": For getting the contents of all registries.
  50.             property 'forge.logging.markers', 'REGISTRIES'
  51.  
  52.             // Recommended logging level for the console
  53.             // You can set various levels here.
  54.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  55.             property 'forge.logging.console.level', 'debug'
  56.  
  57.             mods {
  58.                 testmod {
  59.                     source sourceSets.main
  60.                 }
  61.             }
  62.         }
  63.  
  64.         server {
  65.             workingDirectory project.file('run')
  66.  
  67.             // Recommended logging data for a userdev environment
  68.             // The markers can be changed as needed.
  69.             // "SCAN": For mods scan.
  70.             // "REGISTRIES": For firing of registry events.
  71.             // "REGISTRYDUMP": For getting the contents of all registries.
  72.             property 'forge.logging.markers', 'REGISTRIES'
  73.  
  74.             // Recommended logging level for the console
  75.             // You can set various levels here.
  76.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  77.             property 'forge.logging.console.level', 'debug'
  78.  
  79.             mods {
  80.                 testmod {
  81.                     source sourceSets.main
  82.                 }
  83.             }
  84.         }
  85.  
  86.         data {
  87.             workingDirectory project.file('run')
  88.  
  89.             // Recommended logging data for a userdev environment
  90.             // The markers can be changed as needed.
  91.             // "SCAN": For mods scan.
  92.             // "REGISTRIES": For firing of registry events.
  93.             // "REGISTRYDUMP": For getting the contents of all registries.
  94.             property 'forge.logging.markers', 'REGISTRIES'
  95.  
  96.             // Recommended logging level for the console
  97.             // You can set various levels here.
  98.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  99.             property 'forge.logging.console.level', 'debug'
  100.  
  101.             // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
  102.             args '--mod', 'testmod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  103.  
  104.             mods {
  105.                 testmod {
  106.                     source sourceSets.main
  107.                 }
  108.             }
  109.         }
  110.     }
  111. }
  112.  
  113. // Include resources generated by data generators.
  114. sourceSets.main.resources { srcDir 'src/generated/resources' }
  115.  
  116. dependencies {
  117.     // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
  118.     // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
  119.     // The userdev artifact is a special name and will get all sorts of transformations applied to it.
  120.     minecraft 'net.minecraftforge:forge:1.16.5-36.2.34'
  121.  
  122.     //Geckolib dependency
  123.     implementation fg.deobf('software.bernie.geckolib:geckolib-forge-1.16:3.0.57')
  124.  
  125.     // You may put jars on which you depend on in ./libs or you may define them like so..
  126.     // compile "some.group:artifact:version:classifier"
  127.     // compile "some.group:artifact:version"
  128.  
  129.     // Real examples
  130.     // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
  131.     // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
  132.  
  133.     // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
  134.     // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  135.  
  136.     // These dependencies get remapped to your current MCP mappings
  137.     // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  138.  
  139.     // For more info...
  140.     // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  141.     // http://www.gradle.org/docs/current/userguide/dependency_management.html
  142.  
  143. }
  144.  
  145. // Example for how to get properties into the manifest for reading by the runtime..
  146. jar {
  147.     manifest {
  148.         attributes([
  149.             "Specification-Title": "testmod",
  150.             "Specification-Vendor": "testmodsareus",
  151.             "Specification-Version": "1", // We are version 1 of ourselves
  152.             "Implementation-Title": project.name,
  153.             "Implementation-Version": "${version}",
  154.             "Implementation-Vendor" :"testmodsareus",
  155.             "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  156.         ])
  157.     }
  158. }
  159.  
  160. // Example configuration to allow publishing using the maven-publish task
  161. // This is the preferred method to reobfuscate your jar file
  162. jar.finalizedBy('reobfJar')
  163. // 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
  164. //publish.dependsOn('reobfJar')
  165.  
  166. publishing {
  167.     publications {
  168.         mavenJava(MavenPublication) {
  169.             artifact jar
  170.         }
  171.     }
  172.     repositories {
  173.         maven {
  174.             name = 'GeckoLib'
  175.             url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/'
  176.         }
  177.     }
  178. }
  179.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement