Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2023
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.97 KB | None | 0 0
  1. pluginManagement {
  2. repositories {
  3. maven { url "https://plugins.gradle.org/m2/" }
  4. gradlePluginPortal()
  5. }
  6. }
  7.  
  8. buildscript {
  9. repositories {
  10. // These repositories are only for Gradle plugins, put any other repositories in the repository block further below
  11. maven { url = 'https://maven.minecraftforge.net' }
  12. maven { url = 'https://maven.parchmentmc.org' }
  13. mavenCentral()
  14. }
  15. dependencies {
  16. classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
  17. classpath 'org.parchmentmc:librarian:1.+'
  18. }
  19. }
  20. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
  21. plugins {
  22.  
  23. id 'eclipse'
  24. id 'maven-publish'
  25. id 'org.parchmentmc.librarian.forgegradle' version '1.+'
  26.  
  27. apply plugin: 'net.minecraftforge.gradle'
  28. apply plugin: 'org.parchmentmc.librarian.forgegradle'
  29. }
  30.  
  31. version = '0.1.1-1.18.2'
  32. group = 'net.betamods.test' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  33. archivesBaseName = 'test'
  34.  
  35. // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
  36. java.toolchain.languageVersion = JavaLanguageVersion.of(17)
  37.  
  38. println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
  39. minecraft {
  40. // The mappings can be changed at any time and must be in the following format.
  41. // Channel: Version:
  42. // official MCVersion Official field/method names from Mojang mapping files
  43. // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
  44. //
  45. // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
  46. // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
  47. //
  48. // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
  49. // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
  50. //
  51. // Use non-default mappings at your own risk. They may not always work.
  52. // Simply re-run your setup task after changing the mappings to update your workspace.
  53. mappings channel: 'parchment', version: '2022.08.07-1.18.2'
  54.  
  55. // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.
  56.  
  57. // Default run configurations.
  58. // These can be tweaked, removed, or duplicated as needed.
  59. runs {
  60. client {
  61. workingDirectory project.file('run')
  62.  
  63. // Recommended logging data for a userdev environment
  64. // The markers can be added/remove as needed separated by commas.
  65. // "SCAN": For mods scan.
  66. // "REGISTRIES": For firing of registry events.
  67. // "REGISTRYDUMP": For getting the contents of all registries.
  68. property 'forge.logging.markers', 'REGISTRIES'
  69.  
  70. // Recommended logging level for the console
  71. // You can set various levels here.
  72. // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  73. property 'forge.logging.console.level', 'debug'
  74.  
  75. // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
  76. property 'forge.enabledGameTestNamespaces', 'examplemod'
  77.  
  78. mods {
  79. examplemod {
  80. source sourceSets.main
  81. }
  82. }
  83. }
  84.  
  85. server {
  86. workingDirectory project.file('run')
  87.  
  88. property 'forge.logging.markers', 'REGISTRIES'
  89.  
  90. property 'forge.logging.console.level', 'debug'
  91.  
  92. // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
  93. property 'forge.enabledGameTestNamespaces', 'examplemod'
  94.  
  95. mods {
  96. examplemod {
  97. source sourceSets.main
  98. }
  99. }
  100. }
  101.  
  102. // This run config launches GameTestServer and runs all registered gametests, then exits.
  103. // By default, the server will crash when no gametests are provided.
  104. // The gametest system is also enabled by default for other run configs under the /test command.
  105. gameTestServer {
  106. workingDirectory project.file('run')
  107.  
  108. // Recommended logging data for a userdev environment
  109. // The markers can be added/remove as needed separated by commas.
  110. // "SCAN": For mods scan.
  111. // "REGISTRIES": For firing of registry events.
  112. // "REGISTRYDUMP": For getting the contents of all registries.
  113. property 'forge.logging.markers', 'REGISTRIES'
  114.  
  115. // Recommended logging level for the console
  116. // You can set various levels here.
  117. // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  118. property 'forge.logging.console.level', 'debug'
  119.  
  120. // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
  121. property 'forge.enabledGameTestNamespaces', 'examplemod'
  122.  
  123. mods {
  124. examplemod {
  125. source sourceSets.main
  126. }
  127. }
  128. }
  129.  
  130. data {
  131. workingDirectory project.file('run')
  132.  
  133. property 'forge.logging.markers', 'REGISTRIES'
  134.  
  135. property 'forge.logging.console.level', 'debug'
  136.  
  137. // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
  138. args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
  139.  
  140. mods {
  141. examplemod {
  142. source sourceSets.main
  143. }
  144. }
  145. }
  146. }
  147. }
  148.  
  149. // Include resources generated by data generators.
  150. sourceSets.main.resources { srcDir 'src/generated/resources' }
  151.  
  152. repositories {
  153. // Put repositories for dependencies here
  154. // ForgeGradle automatically adds the Forge maven and Maven Central for you
  155.  
  156. // If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
  157. // flatDir {
  158. // dir 'libs'
  159. // }
  160. }
  161.  
  162. dependencies {
  163. // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
  164. // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
  165. // The userdev artifact is a special name and will get all sorts of transformations applied to it.
  166. minecraft 'net.minecraftforge:forge:1.18.2-40.2.0'
  167.  
  168. // Real mod deobf dependency examples - these get remapped to your current mappings
  169. // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
  170. // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
  171. // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
  172.  
  173. // Examples using mod jars from ./libs
  174. // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
  175.  
  176. // For more info...
  177. // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  178. // http://www.gradle.org/docs/current/userguide/dependency_management.html
  179. }
  180.  
  181. // Example for how to get properties into the manifest for reading at runtime.
  182. jar {
  183. manifest {
  184. attributes([
  185. "Specification-Title" : "examplemod",
  186. "Specification-Vendor" : "examplemodsareus",
  187. "Specification-Version" : "1", // We are version 1 of ourselves
  188. "Implementation-Title" : project.name,
  189. "Implementation-Version" : project.jar.archiveVersion,
  190. "Implementation-Vendor" : "examplemodsareus",
  191. "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  192. ])
  193. }
  194. }
  195.  
  196. // Example configuration to allow publishing using the maven-publish plugin
  197. // This is the preferred method to reobfuscate your jar file
  198. jar.finalizedBy('reobfJar')
  199. // 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
  200. // publish.dependsOn('reobfJar')
  201.  
  202. publishing {
  203. publications {
  204. mavenJava(MavenPublication) {
  205. artifact jar
  206. }
  207. }
  208. repositories {
  209. maven {
  210. url "file://${project.projectDir}/mcmodsrepo"
  211. }
  212. }
  213. }
  214.  
  215. tasks.withType(JavaCompile).configureEach {
  216. options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
  217. }
  218.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement