Advertisement
Guest User

Untitled

a guest
Jun 6th, 2021
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.28 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: '4.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.0'
  16. group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  17. archivesBaseName = 'modid'
  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: 'official', version: '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. examplemod {
  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. examplemod {
  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', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  103.  
  104. mods {
  105. examplemod {
  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.1.25'
  121.  
  122. // You may put jars on which you depend on in ./libs or you may define them like so..
  123. // compile "some.group:artifact:version:classifier"
  124. // compile "some.group:artifact:version"
  125.  
  126. // Real examples
  127. // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
  128. // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
  129.  
  130. // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
  131. // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  132.  
  133. // These dependencies get remapped to your current MCP mappings
  134. // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  135.  
  136. // For more info...
  137. // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  138. // http://www.gradle.org/docs/current/userguide/dependency_management.html
  139.  
  140. }
  141.  
  142. // Example for how to get properties into the manifest for reading by the runtime..
  143. jar {
  144. manifest {
  145. attributes([
  146. "Specification-Title": "examplemod",
  147. "Specification-Vendor": "examplemodsareus",
  148. "Specification-Version": "1", // We are version 1 of ourselves
  149. "Implementation-Title": project.name,
  150. "Implementation-Version": "${version}",
  151. "Implementation-Vendor" :"examplemodsareus",
  152. "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  153. ])
  154. }
  155. }
  156.  
  157. // Example configuration to allow publishing using the maven-publish task
  158. // This is the preferred method to reobfuscate your jar file
  159. jar.finalizedBy('reobfJar')
  160. // 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
  161. //publish.dependsOn('reobfJar')
  162.  
  163. publishing {
  164. publications {
  165. mavenJava(MavenPublication) {
  166. artifact jar
  167. }
  168. }
  169. repositories {
  170. maven {
  171. url "file:///${project.projectDir}/mcmodsrepo"
  172. }
  173. }
  174. }
  175.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement