= 创作分享 =
编程开发
[Forge 1.18.2] Parchment装不上
JEMods

[Forge 1.18.2] Parchment装不上

JEMods 于 2024-7-23 11:10 ( 1月前 ) [复制链接] [只看楼主] [打印]
236 0
40RF
昨天到今天, 1天了....死活装不上去求帮助
PS: 今天在MC Forge Forum上找到和我几乎一样的问题(但是没人回答
build.gradle:

  1. [spoiler=我的build.gradle]buildscript {
  2.     repositories {
  3.         // These repositories are only for Gradle plugins, put any other repositories in the repository block further below
  4.         maven { url = 'https://maven.minecraftforge.net' }
  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.parchmentmc:librarian:1.+'
  11.     }
  12. }
  13. // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
  14. plugins {
  15.     id 'eclipse'
  16.     id 'maven-publish'
  17. }
  18. apply plugin: 'net.minecraftforge.gradle'
  19. apply plugin: 'org.parchmentmc.librarian.forgegradle'

  20. version = '1.0'
  21. group = 'com.yourname.modid' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  22. archivesBaseName = 'modid'

  23. // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
  24. java.toolchain.languageVersion = JavaLanguageVersion.of(17)

  25. println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
  26. minecraft {
  27.     // The mappings can be changed at any time and must be in the following format.
  28.     // Channel:   Version:
  29.     // official   MCVersion             Official field/method names from Mojang mapping files
  30.     // parchment  YYYY.MM.DD-MCVersion  Open community-sourced parameter names and javadocs layered on top of official
  31.     //
  32.     // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
  33.     // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
  34.     //
  35.     // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
  36.     // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started
  37.     //
  38.     // Use non-default mappings at your own risk. They may not always work.
  39.     // Simply re-run your setup task after changing the mappings to update your workspace.
  40.     // mappings channel: 'official', version: '1.18.2'
  41.     mappings channel: 'parchment', version: '2022.11.06-1.18.2'
  42.     // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.

  43.     // Default run configurations.
  44.     // These can be tweaked, removed, or duplicated as needed.
  45.     runs {
  46.         client {
  47.             workingDirectory project.file('run')

  48.             // Recommended logging data for a userdev environment
  49.             // The markers can be added/remove as needed separated by commas.
  50.             // "SCAN": For mods scan.
  51.             // "REGISTRIES": For firing of registry events.
  52.             // "REGISTRYDUMP": For getting the contents of all registries.
  53.             property 'forge.logging.markers', 'REGISTRIES'

  54.             // Recommended logging level for the console
  55.             // You can set various levels here.
  56.             // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
  57.             property 'forge.logging.console.level', 'debug'

  58.             // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
  59.             property 'forge.enabledGameTestNamespaces', 'examplemod'

  60.             mods {
  61.                 examplemod {
  62.                     source sourceSets.main
  63.                 }
  64.             }
  65.         }

  66.         server {
  67.             workingDirectory project.file('run')

  68.             property 'forge.logging.markers', 'REGISTRIES'

  69.             property 'forge.logging.console.level', 'debug'

  70.             // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
  71.             property 'forge.enabledGameTestNamespaces', 'examplemod'

  72.             mods {
  73.                 examplemod {
  74.                     source sourceSets.main
  75.                 }
  76.             }
  77.         }

  78.         // This run config launches GameTestServer and runs all registered gametests, then exits.
  79.         // By default, the server will crash when no gametests are provided.
  80.         // The gametest system is also enabled by default for other run configs under the /test command.
  81.         gameTestServer {
  82.             workingDirectory project.file('run')

  83.             // Recommended logging data for a userdev environment
  84.             // The markers can be added/remove as needed separated by commas.
  85.             // "SCAN": For mods scan.
  86.             // "REGISTRIES": For firing of registry events.
  87.             // "REGISTRYDUMP": For getting the contents of all registries.
  88.             property 'forge.logging.markers', 'REGISTRIES'

  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.             // Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
  94.             property 'forge.enabledGameTestNamespaces', 'examplemod'

  95.             mods {
  96.                 examplemod {
  97.                     source sourceSets.main
  98.                 }
  99.             }
  100.         }

  101.         data {
  102.             workingDirectory project.file('run')

  103.             property 'forge.logging.markers', 'REGISTRIES'

  104.             property 'forge.logging.console.level', 'debug'

  105.             // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
  106.             args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

  107.             mods {
  108.                 examplemod {
  109.                     source sourceSets.main
  110.                 }
  111.             }
  112.         }
  113.     }
  114. }

  115. // Include resources generated by data generators.
  116. sourceSets.main.resources { srcDir 'src/generated/resources' }

  117. repositories {
  118.     // Put repositories for dependencies here
  119.     // ForgeGradle automatically adds the Forge maven and Maven Central for you

  120.     // If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
  121.     // flatDir {
  122.     //     dir 'libs'
  123.     // }
  124. }

  125. dependencies {
  126.     // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
  127.     // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
  128.     // The userdev artifact is a special name and will get all sorts of transformations applied to it.
  129.     minecraft 'net.minecraftforge:forge:1.18.2-40.2.0'

  130.     // Real mod deobf dependency examples - these get remapped to your current mappings
  131.     // compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
  132.     // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
  133.     // implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency

  134.     // Examples using mod jars from ./libs
  135.     // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")

  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. // Example for how to get properties into the manifest for reading at runtime.
  141. jar {
  142.     manifest {
  143.         attributes([
  144.                 "Specification-Title"     : "examplemod",
  145.                 "Specification-Vendor"    : "examplemodsareus",
  146.                 "Specification-Version"   : "1", // We are version 1 of ourselves
  147.                 "Implementation-Title"    : project.name,
  148.                 "Implementation-Version"  : project.jar.archiveVersion,
  149.                 "Implementation-Vendor"   : "examplemodsareus",
  150.                 "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
  151.         ])
  152.     }
  153. }

  154. // Example configuration to allow publishing using the maven-publish plugin
  155. // This is the preferred method to reobfuscate your jar file
  156. jar.finalizedBy('reobfJar')
  157. // 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
  158. // publish.dependsOn('reobfJar')

  159. publishing {
  160.     publications {
  161.         mavenJava(MavenPublication) {
  162.             artifact jar
  163.         }
  164.     }
  165.     repositories {
  166.         maven {
  167.             url "file://${project.projectDir}/mcmodsrepo"
  168.         }
  169.     }
  170. }

  171. tasks.withType(JavaCompile).configureEach {
  172.     options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
  173. }[/spoiler]
复制代码
报错:
org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':mavenDownloader_net.minecraftforge_accesstransformers_8.0.+_fatjar_1'

gradle.internal.resolve.ModuleVersionNotFoundException: Cannot resolve external dependency net.minecraftforge:accesstransformers:8.0.+ because no repositories are defined.

Error getting artifact: net.minecraftforge:forge:1.18.2-40.2.0_mapped_parchment_2022.11.06-1.18.2:null@jar from  MinecraftUserRepo

Could not resolve all files for configuration ':runtimeClasspathCopy'.
> Could not find net.minecraftforge:forge:1.18.2-40.2.0_mapped_parchment_2022.11.06-1.18.2.



发表于 2024-7-23 11:10:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

回复 | 举报

该帖共收到 0 条回复!
百科目前不允许匿名发帖哦~ 请先 [ 登陆 ][ 注册 ] 吧~

本版积分规则

发新帖
  • 回复
  • 点评
  • 评分

[ MC百科(mcmod.cn) 除另有声明,所有开放公共编辑的内容均使用 BY-NC-SA 3.0 协议 ]

Minecraft百科CC协议
快速回复 返回顶部 返回列表