Guest User

Untitled

a guest
Dec 5th, 2023
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.12 KB | None | 0 0
  1. `import org.example.JavaModuleTransform
  2.  
  3.  
  4.  
  5. plugins {
  6. id("net.minecraftforge.gradle") version "6.+"
  7. id("com.github.johnrengelman.shadow") version "7.1.2"
  8. id("wtf.gofancy.fancygradle") version "1.1.+"
  9. id("org.gradlex.extra-java-module-info") version "1.6"
  10. }
  11.  
  12.  
  13. apply from: "buildSrc/build.gradle"
  14.  
  15. dependencies.registerTransform(JavaModuleTransform.class) {
  16. from.attributes.attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, "jar")
  17. to.attributes.attribute(ArtifactTypeDefinition.ARTIFACT_TYPE_ATTRIBUTE, "jar")
  18. }
  19.  
  20.  
  21. buildSrc/build.gradle
  22.  
  23. buildscript {
  24. repositories {
  25. maven { url = "https://plugins.gradle.org/m2/" }
  26.  
  27. maven { url = "https://mvnrepository.com/artifact/" }
  28. jcenter()
  29.  
  30. gradlePluginPortal()
  31. maven {
  32. name 'MinecraftForge'
  33. url 'https://maven.minecraftforge.net/'
  34. }
  35. maven {
  36. name 'Garden of Fancy'
  37. url 'https://maven.gofancy.wtf/releases'
  38. }
  39. maven{ url = "https://maven.mcmoddev.com/" }
  40. maven{ url = "https://jitpack.io" }
  41. maven{ url = "https://maven.apache.org/" }
  42. maven{ url = "https://repository.ow2.org/nexus/" }
  43. maven{
  44. url = "https://libraries.minecraft.net"
  45. }
  46. maven{ url = "https://oss.sonatype.org/content/repositories/snapshots" }
  47.  
  48. maven{ url = "https://repo.spring.io/milestone" }
  49. }
  50. dependencies {
  51. classpath("gradle.plugin.com.github.johnrengelman:shadow:7.1.2")
  52. classpath 'net.minecraftforge.gradle:ForgeGradle:6.+'
  53. classpath("org.gradlex:extra-java-module-info:1.6")
  54. classpath group: 'wtf.gofancy.fancygradle', name: 'wtf.gofancy.fancygradle.gradle.plugin', version: '1.1.+'
  55. }
  56. }
  57.  
  58. apply {
  59. plugin("java-base")
  60. plugin("groovy")
  61. plugin("eclipse")
  62. plugin("wtf.gofancy.fancygradle")
  63. plugin("org.gradlex.extra-java-module-info")
  64. plugin("net.minecraftforge.gradle")
  65. plugin("java")
  66. plugin("com.github.johnrengelman.shadow")
  67. plugin("maven-publish")
  68. }
  69.  
  70. fancyGradle {
  71. patches {
  72. resources
  73. coremods
  74. codeChickenLib
  75. asm
  76. mergetool
  77. }
  78. }
  79. sourceSets {
  80. main {
  81. java {
  82. srcDirs = ["src/main/java"]
  83. }
  84. }
  85. }
  86.  
  87. version = "0.1"
  88. java {
  89. toolchain {
  90. languageVersion.set(JavaLanguageVersion.of(8))
  91. }
  92. }
  93.  
  94.  
  95. group = "com.nullptr.mod"
  96.  
  97. minecraft {
  98.  
  99.  
  100. mappings channel: 'stable', version: '39-1.12'
  101.  
  102.  
  103. runs {
  104. client {
  105. workingDirectory project.file('run/client')
  106.  
  107. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  108.  
  109. property 'forge.logging.console.level', 'debug'
  110. }
  111.  
  112. server {
  113. workingDirectory project.file('run/server')
  114.  
  115. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  116.  
  117. property 'forge.logging.console.level', 'debug'
  118. }
  119. }
  120. }
  121. extraJavaModuleInfo {
  122. failOnMissingModuleInfo.set(false)
  123. }
  124. configurations {
  125. library
  126. implementation.extendsFrom library
  127. shadow.extendsFrom library
  128. }
  129.  
  130. dependencies {
  131. implementation 'javax.inject:javax.inject:1'
  132. implementation "org.codehaus.groovy:groovy-all:3.0.15"
  133. println("123")
  134. minecraft("net.minecraftforge:forge:1.12.2-14.23.5.2860")
  135. library "org.slf4j:slf4j-api:1.7.36"
  136. library 'commons-io:commons-io:2.15.0'
  137. library "net.dv8tion:JDA:5.0.0-beta.12"
  138. library 'com.neovisionaries:nv-websocket-client:2.14'
  139. library "com.squareup.okhttp3:okhttp:4.10.0"
  140. library "com.fasterxml.jackson.core:jackson-databind:2.15.2"
  141. library "club.minnced:discord-webhooks:0.8.4"
  142. library "net.sf.trove4j:trove4j:3.0.3"
  143. library "com.theokanning.openai-gpt3-java:service:0.12.0"
  144. library "org.apache.commons:commons-collections4:4.4"
  145. }
  146.  
  147. tasks.withType(JavaCompile).configureEach {
  148. options.encoding = "UTF-8"
  149. }
  150. jar {
  151. archiveClassifier.set("mod")
  152. archiveBaseName.set("mod")
  153. duplicatesStrategy = DuplicatesStrategy.EXCLUDE
  154. manifest {
  155.  
  156. attributes([
  157.  
  158. "Specification-Title": "examplemod",
  159.  
  160. "Specification-Vendor": "examplemodsareus",
  161.  
  162. "Specification-Version": "1", // We are version 1 of ourselves
  163.  
  164. "Implementation-Title": project.name,
  165.  
  166. "Implementation-Version": "${version}",
  167.  
  168. "Implementation-Vendor" :"examplemodsareus",
  169.  
  170. "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  171.  
  172. ])
  173.  
  174. }
  175.  
  176. }
  177.  
  178.  
  179. shadowJar {
  180.  
  181.  
  182. configurations = [project.configurations.shadow]
  183.  
  184.  
  185.  
  186.  
  187. archiveClassifier.set("")
  188. manifest.attributes(jar.manifest.getAttributes())
  189. exclude 'module-info.class'
  190. exclude 'META-INF/versions/9/module-info.class'
  191. dependencies{
  192. exclude(dependency('org.jetbrains:annotations'))
  193. exclude(dependency('com.google.code.findbugs:jsr305'))
  194. }
  195. doFirst {
  196. project.configurations.library.incoming.resolutionResult.allComponents {
  197. if (it.id instanceof ModuleComponentIdentifier) {
  198. relocate(it.id.group, "${project.group}.shadow.${it.id.group}")
  199. println(it.id.group)
  200.  
  201.  
  202.  
  203. }
  204. }
  205. }
  206. minimize()
  207. }
  208.  
  209. reobf {
  210. shadowJar {}
  211. }
  212.  
  213. tasks.build.dependsOn reobfShadowJar
  214. jar.finalizedBy('reobfJar')
  215.  
  216. artifacts {
  217. archives jar
  218. archives shadowJar
  219.  
  220. }
  221.  
  222. processResources {
  223. duplicatesStrategy = "include"
  224.  
  225. inputs.property "version", project.version
  226. inputs.property "mcversion", "1.12.2"
  227.  
  228. from(sourceSets.main.resources.srcDirs) {
  229. include("mcmod.info")
  230. expand("version": project.version, "mcversion": "1.12.2")
  231. }
  232.  
  233. from(sourceSets.main.resources.srcDirs) {
  234. exclude("mcmod.info")
  235. }
  236. }
  237.  
  238. publishing {
  239. publications {
  240. mavenJava(MavenPublication) {
  241. artifact jar
  242. }
  243. }
  244. repositories {
  245. maven {
  246. url "file:///${project.projectDir}/mcmodsrepo"
  247. }
  248. }
  249. }
  250. legacy {
  251. fixClasspath = true
  252. }
  253. `
Add Comment
Please, Sign In to add comment