Skyriiis

Untitled

Apr 13th, 2022
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 6.67 KB | None | 0 0
  1. buildscript {
  2.     repositories {
  3.         maven { url = 'https://maven.minecraftforge.net' }
  4.         maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
  5.         maven { url = 'https://maven.parchmentmc.org' }
  6.         mavenCentral()
  7.     }
  8.     dependencies {
  9.         classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
  10.         classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
  11.         classpath 'org.parchmentmc:librarian:1.+'
  12.     }
  13. }
  14.  
  15. plugins {
  16.     id 'mms.java-conventions'
  17. }
  18.  
  19. java{
  20.     archivesBaseName = namePrefix + "forge"
  21. }
  22.  
  23. apply plugin: 'net.minecraftforge.gradle'
  24. apply plugin: 'org.spongepowered.mixin'
  25. apply plugin: 'org.parchmentmc.librarian.forgegradle'
  26.  
  27. minecraft {
  28.     mappings channel: 'parchment', version: parchmentVersion + "-" + mcVersion
  29.     // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  30.     runs {
  31.         client {
  32.             workingDirectory project.file('run')
  33.  
  34.             // Recommended logging data for a userdev environment
  35.             // The markers can be added/removed as needed separated by commas.
  36.             // "SCAN": For mods scan.
  37.             // "REGISTRIES": For firing of registry events.
  38.             // "REGISTRYDUMP": For getting the contents of all registries.
  39.             property 'forge.logging.markers', 'REGISTRIES'
  40.  
  41.             // Recommended logging level for the console
  42.             // You can set various levels here.
  43.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  44.             property 'forge.logging.console.level', 'debug'
  45.  
  46.             property 'forge.enabledGameTestNamespaces', 'statistics'
  47.  
  48.             mods {
  49.                 statistics {
  50.                     source sourceSets.main
  51.                 }
  52.             }
  53.         }
  54.  
  55.         server {
  56.             workingDirectory project.file('run')
  57.  
  58.             // Recommended logging data for a userdev environment
  59.             // The markers can be added/removed as needed separated by commas.
  60.             // "SCAN": For mods scan.
  61.             // "REGISTRIES": For firing of registry events.
  62.             // "REGISTRYDUMP": For getting the contents of all registries.
  63.             property 'forge.logging.markers', 'REGISTRIES'
  64.  
  65.             // Recommended logging level for the console
  66.             // You can set various levels here.
  67.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  68.             property 'forge.logging.console.level', 'debug'
  69.  
  70.             property 'forge.enabledGameTestNamespaces', 'statistics'
  71.  
  72.             mods {
  73.                 statistics {
  74.                     source sourceSets.main
  75.                 }
  76.             }
  77.         }
  78.  
  79.         gameTestServer {
  80.             workingDirectory project.file('run')
  81.  
  82.             // Recommended logging data for a userdev environment
  83.             // The markers can be added/remove as needed separated by commas.
  84.             // "SCAN": For mods scan.
  85.             // "REGISTRIES": For firing of registry events.
  86.             // "REGISTRYDUMP": For getting the contents of all registries.
  87.             property 'forge.logging.markers', 'REGISTRIES'
  88.  
  89.             // Recommended logging level for the console
  90.             // You can set various levels here.
  91.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  92.             property 'forge.logging.console.level', 'debug'
  93.  
  94.             // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
  95.             property 'forge.enabledGameTestNamespaces', 'statistics'
  96.  
  97.             mods {
  98.                 statistics {
  99.                     source sourceSets.main
  100.                 }
  101.             }
  102.         }
  103.  
  104.         data {
  105.             workingDirectory project.file('run')
  106.  
  107.             // Recommended logging data for a userdev environment
  108.             // The markers can be added/removed as needed separated by commas.
  109.             // "SCAN": For mods scan.
  110.             // "REGISTRIES": For firing of registry events.
  111.             // "REGISTRYDUMP": For getting the contents of all registries.
  112.             property 'forge.logging.markers', 'REGISTRIES'
  113.  
  114.             // Recommended logging level for the console
  115.             // You can set various levels here.
  116.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  117.             property 'forge.logging.console.level', 'debug'
  118.  
  119.             // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
  120.             args '--mod', 'statistics', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  121.  
  122.             mods {
  123.                 statistics {
  124.                     source sourceSets.main
  125.                 }
  126.             }
  127.         }
  128.     }
  129. }
  130.  
  131. mixin {
  132.     add sourceSets.main, "statistics.refmap.json"
  133.  
  134.     config "statistics.mixins.json"
  135. }
  136.  
  137. // Include resources generated by data generators.
  138. sourceSets.main.resources { srcDir 'src/generated/resources' }
  139.  
  140. repositories {
  141.     // If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
  142.     // flatDir {
  143.     //     dir 'libs'
  144.     // }
  145. }
  146.  
  147. dependencies {
  148.     minecraft 'net.minecraftforge:forge:' + mcVersion + '-' + forgeVersion
  149.     annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
  150. }
  151.  
  152. // Example for how to get properties into the manifest for reading at runtime.
  153. jar {
  154.     manifest {
  155.         attributes([
  156.                 "Specification-Title"     : "statistics",
  157.                 "Specification-Vendor"    : "MrProfessor",
  158.                 "Specification-Version"   : "1", // We are version 1 of ourselves
  159.                 "Implementation-Title"    : project.name,
  160.                 "Implementation-Version"  : project.jar.archiveVersion,
  161.                 "Implementation-Vendor"   : "MrProfessor",
  162.                 "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  163.         ])
  164.     }
  165. }
  166.  
  167. def replaceResources = tasks.register("replaceResources", Copy) {
  168.     it.outputs.upToDateWhen { false }
  169.     //Copy it into the build dir
  170.     it.from(sourceSets.main.resources) {
  171.         include "META-INF/mods.toml"
  172.         expand 'modVersion': "${project.version}"
  173.     }
  174.     it.into "$buildDir/resources/main/"
  175. }
  176.  
  177. processResources {
  178.     duplicatesStrategy(DuplicatesStrategy.FAIL)
  179.     exclude('META-INF/mods.toml')
  180.     configure { finalizedBy(replaceResources) }
  181. }
  182.  
  183. classes.configure {
  184.     dependsOn(replaceResources)
  185. }
  186.  
  187. assemble.dependsOn('reobfJar')
  188.  
Advertisement
Add Comment
Please, Sign In to add comment