
[Question] 如何在自己的MOD中使用此库
zhenaiwork opened this issue · 10 comments
Question Type
Codes
Description
我想要让自己的mod输出一个可以点击高亮的坐标需要使用你的这个库来实现,但是一直不清楚如何修改gradle文件
按此格式导入依赖:
repositories {
maven {
name("Nyan Maven")
url("https://maven.hendrixshen.top")
}
}
dependencies {
modImplementation("top.hendrixshen:magiclib-<minecraft_version>:<magiclib_version>")
}
例:
repositories {
maven {
name("Nyan Maven")
url("https://maven.hendrixshen.top")
}
}
dependencies {
// MC版本号需将 '.' 替换为 '_',MagicLib可以通过Release页面找到,Assets里面的文件列表即为该版本支持MC版本。
modImplementation("top.hendrixshen:magiclib-1_19_3:0.6.212+a47eb26-stable")
}
> Could not resolve all files for configuration ':modImplementation'.
> Could not find top.hendrixshen::magiclib-1_18_2.
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
maven {
name("magiclib")
url("https://maven.hendrixshen.top")
}
}
dependencies {
// MC版本号需将 '.' 替换为 '_',MagicLib可以通过Release页面找到,Assets里面的文件列表即为该版本支持MC版本。
modImplementation("top.hendrixshen::magiclib-1_18_2:0.6.221+5077f40-beta")
}
}
:(
请问是哪里出了问题
maven { name("magiclib") url("https://maven.hendrixshen.top") } } dependencies { // MC版本号需将 '.' 替换为 '_',MagicLib可以通过Release页面找到,Assets里面的文件列表即为该版本支持MC版本。 modImplementation("top.hendrixshen::magiclib-1_18_2:0.6.221+5077f40-beta") ^这里是一个: } }
> Could not resolve all files for configuration ':modImplementation'.
> Could not find top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta.
Searched in the following locations:
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/remapped_mods/top/hendrixshen/magiclib-1_18_2/0.6.221+5077f40-beta/magiclib-1_18_2-0.6.221+5077f40-beta.pom
- file:/home/zhenai/.gradle/caches/fabric-loom/minecraftMaven/top/hendrixshen/magiclib-1_18_2/0.6.221+5077f40-beta/magiclib-1_18_2-0.6.221+5077f40-beta.pom
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/minecraftMaven/top/hendrixshen/magiclib-1_18_2/0.6.221+5077f40-beta/magiclib-1_18_2-0.6.221+5077f40-beta.pom
- https://maven.fabricmc.net/top/hendrixshen/magiclib-1_18_2/0.6.221+5077f40-beta/magiclib-1_18_2-0.6.221+5077f40-beta.pom
- https://libraries.minecraft.net/top/hendrixshen/magiclib-1_18_2/0.6.221+5077f40-beta/magiclib-1_18_2-0.6.221+5077f40-beta.pom
- https://libraries.minecraft.net/top/hendrixshen/magiclib-1_18_2/0.6.221+5077f40-beta/magiclib-1_18_2-0.6.221+5077f40-beta.jar
- https://repo.maven.apache.org/maven2/top/hendrixshen/magiclib-1_18_2/0.6.221+5077f40-beta/magiclib-1_18_2-0.6.221+5077f40-beta.pom
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
:(
这个是为什么啊
plugins {
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'maven-publish'
}
version = project.mod_version
group = project.maven_group
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}
processResources {
inputs.property "version", project.version
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release = targetJavaVersion
}
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
archivesBaseName = project.archives_base_name
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
maven {
name("magiclib")
url("https://maven.hendrixshen.top")
}
}
dependencies {
// MC版本号需将 '.' 替换为 '_',MagicLib可以通过Release页面找到,Assets里面的文件列表即为该版本支持MC版本。
modImplementation("top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta")
}
}
plugins {
id 'fabric-loom' version '1.1-SNAPSHOT'
id 'maven-publish'
}
version = project.mod_version
group = project.maven_group
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
+ maven {
+ name("CurseForge Maven")
+ url("https://www.cursemaven.com")
+ }
+ maven {
+ name("Nyan Maven")
+ url("https://maven.hendrixshen.top")
+ }
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
+ modImplementation("top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta")
}
processResources {
inputs.property "version", project.version
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release = targetJavaVersion
}
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
archivesBaseName = project.archives_base_name
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
- maven {
- name("magiclib")
- url("https://maven.hendrixshen.top")
- }
}
- dependencies {
- // MC版本号需将 '.' 替换为 '_',MagicLib可以通过Release页面找到,Assets里面的文件列表即为该版本支持MC版本。
- modImplementation("top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta")
- }
}
A problem occurred configuring root project 'where it'.
> Could not resolve all files for configuration ':modImplementation'.
> Could not find curse.maven:carpet-349239:3725895.
Searched in the following locations:
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/remapped_mods/curse/maven/carpet-349239/3725895/carpet-349239-3725895.pom
- file:/home/zhenai/.gradle/caches/fabric-loom/minecraftMaven/curse/maven/carpet-349239/3725895/carpet-349239-3725895.pom
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/minecraftMaven/curse/maven/carpet-349239/3725895/carpet-349239-3725895.pom
- https://maven.fabricmc.net/curse/maven/carpet-349239/3725895/carpet-349239-3725895.pom
- https://libraries.minecraft.net/curse/maven/carpet-349239/3725895/carpet-349239-3725895.pom
- https://libraries.minecraft.net/curse/maven/carpet-349239/3725895/carpet-349239-3725895.jar
- https://repo.maven.apache.org/maven2/curse/maven/carpet-349239/3725895/carpet-349239-3725895.pom
- https://maven.hendrixshen.top/curse/maven/carpet-349239/3725895/carpet-349239-3725895.pom
Required by:
project : > top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta
> Could not find curse.maven:malilib-303119:3692220.
Searched in the following locations:
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/remapped_mods/curse/maven/malilib-303119/3692220/malilib-303119-3692220.pom
- file:/home/zhenai/.gradle/caches/fabric-loom/minecraftMaven/curse/maven/malilib-303119/3692220/malilib-303119-3692220.pom
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/minecraftMaven/curse/maven/malilib-303119/3692220/malilib-303119-3692220.pom
- https://maven.fabricmc.net/curse/maven/malilib-303119/3692220/malilib-303119-3692220.pom
- https://libraries.minecraft.net/curse/maven/malilib-303119/3692220/malilib-303119-3692220.pom
- https://libraries.minecraft.net/curse/maven/malilib-303119/3692220/malilib-303119-3692220.jar
- https://repo.maven.apache.org/maven2/curse/maven/malilib-303119/3692220/malilib-303119-3692220.pom
- https://maven.hendrixshen.top/curse/maven/malilib-303119/3692220/malilib-303119-3692220.pom
Required by:
project : > top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta
> Could not find curse.maven:modmenu-308702:4145213.
Searched in the following locations:
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/remapped_mods/curse/maven/modmenu-308702/4145213/modmenu-308702-4145213.pom
- file:/home/zhenai/.gradle/caches/fabric-loom/minecraftMaven/curse/maven/modmenu-308702/4145213/modmenu-308702-4145213.pom
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/minecraftMaven/curse/maven/modmenu-308702/4145213/modmenu-308702-4145213.pom
- https://maven.fabricmc.net/curse/maven/modmenu-308702/4145213/modmenu-308702-4145213.pom
- https://libraries.minecraft.net/curse/maven/modmenu-308702/4145213/modmenu-308702-4145213.pom
- https://libraries.minecraft.net/curse/maven/modmenu-308702/4145213/modmenu-308702-4145213.jar
- https://repo.maven.apache.org/maven2/curse/maven/modmenu-308702/4145213/modmenu-308702-4145213.pom
- https://maven.hendrixshen.top/curse/maven/modmenu-308702/4145213/modmenu-308702-4145213.pom
Required by:
project : > top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta
> Could not find curse.maven:in-game-account-switcher-232676:3993199.
Searched in the following locations:
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/remapped_mods/curse/maven/in-game-account-switcher-232676/3993199/in-game-account-switcher-232676-3993199.pom
- file:/home/zhenai/.gradle/caches/fabric-loom/minecraftMaven/curse/maven/in-game-account-switcher-232676/3993199/in-game-account-switcher-232676-3993199.pom
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/minecraftMaven/curse/maven/in-game-account-switcher-232676/3993199/in-game-account-switcher-232676-3993199.pom
- https://maven.fabricmc.net/curse/maven/in-game-account-switcher-232676/3993199/in-game-account-switcher-232676-3993199.pom
- https://libraries.minecraft.net/curse/maven/in-game-account-switcher-232676/3993199/in-game-account-switcher-232676-3993199.pom
- https://libraries.minecraft.net/curse/maven/in-game-account-switcher-232676/3993199/in-game-account-switcher-232676-3993199.jar
- https://repo.maven.apache.org/maven2/curse/maven/in-game-account-switcher-232676/3993199/in-game-account-switcher-232676-3993199.pom
- https://maven.hendrixshen.top/curse/maven/in-game-account-switcher-232676/3993199/in-game-account-switcher-232676-3993199.pom
Required by:
project : > top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta
> Could not find curse.maven:lazydfu-433518:3209972.
Searched in the following locations:
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/remapped_mods/curse/maven/lazydfu-433518/3209972/lazydfu-433518-3209972.pom
- file:/home/zhenai/.gradle/caches/fabric-loom/minecraftMaven/curse/maven/lazydfu-433518/3209972/lazydfu-433518-3209972.pom
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/minecraftMaven/curse/maven/lazydfu-433518/3209972/lazydfu-433518-3209972.pom
- https://maven.fabricmc.net/curse/maven/lazydfu-433518/3209972/lazydfu-433518-3209972.pom
- https://libraries.minecraft.net/curse/maven/lazydfu-433518/3209972/lazydfu-433518-3209972.pom
- https://libraries.minecraft.net/curse/maven/lazydfu-433518/3209972/lazydfu-433518-3209972.jar
- https://repo.maven.apache.org/maven2/curse/maven/lazydfu-433518/3209972/lazydfu-433518-3209972.pom
- https://maven.hendrixshen.top/curse/maven/lazydfu-433518/3209972/lazydfu-433518-3209972.pom
Required by:
project : > top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta
> Could not find curse.maven:imblockerfabric-399225:4271884.
Searched in the following locations:
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/remapped_mods/curse/maven/imblockerfabric-399225/4271884/imblockerfabric-399225-4271884.pom
- file:/home/zhenai/.gradle/caches/fabric-loom/minecraftMaven/curse/maven/imblockerfabric-399225/4271884/imblockerfabric-399225-4271884.pom
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/minecraftMaven/curse/maven/imblockerfabric-399225/4271884/imblockerfabric-399225-4271884.pom
- https://maven.fabricmc.net/curse/maven/imblockerfabric-399225/4271884/imblockerfabric-399225-4271884.pom
- https://libraries.minecraft.net/curse/maven/imblockerfabric-399225/4271884/imblockerfabric-399225-4271884.pom
- https://libraries.minecraft.net/curse/maven/imblockerfabric-399225/4271884/imblockerfabric-399225-4271884.jar
- https://repo.maven.apache.org/maven2/curse/maven/imblockerfabric-399225/4271884/imblockerfabric-399225-4271884.pom
- https://maven.hendrixshen.top/curse/maven/imblockerfabric-399225/4271884/imblockerfabric-399225-4271884.pom
Required by:
project : > top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta
> Could not find curse.maven:smooth-boot-415758:3692365.
Searched in the following locations:
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/remapped_mods/curse/maven/smooth-boot-415758/3692365/smooth-boot-415758-3692365.pom
- file:/home/zhenai/.gradle/caches/fabric-loom/minecraftMaven/curse/maven/smooth-boot-415758/3692365/smooth-boot-415758-3692365.pom
- file:/home/zhenai/Minecraft - Fabric/where it/.gradle/loom-cache/minecraftMaven/curse/maven/smooth-boot-415758/3692365/smooth-boot-415758-3692365.pom
- https://maven.fabricmc.net/curse/maven/smooth-boot-415758/3692365/smooth-boot-415758-3692365.pom
- https://libraries.minecraft.net/curse/maven/smooth-boot-415758/3692365/smooth-boot-415758-3692365.pom
- https://libraries.minecraft.net/curse/maven/smooth-boot-415758/3692365/smooth-boot-415758-3692365.jar
- https://repo.maven.apache.org/maven2/curse/maven/smooth-boot-415758/3692365/smooth-boot-415758-3692365.pom
- https://maven.hendrixshen.top/curse/maven/smooth-boot-415758/3692365/smooth-boot-415758-3692365.pom
Required by:
project : > top.hendrixshen:magiclib-1_18_2:0.6.221+5077f40-beta
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
eMMMMM