我目前正在进入 Spigot Pugin 开发并需要访问 GameProfile,因为我需要它作为插件(用于更改皮肤的东西)。我正在使用 Eclipse。
现在,我已经观看了大量使用 GameProfile 的教程,所有这些教程都只是为了
import com.mojang.authlib.GameProfile;
Run Code Online (Sandbox Code Playgroud)
或者
import net.minecraft.util.SOMETHINGLONG.GameProfile
Run Code Online (Sandbox Code Playgroud)
无需解释为什么这条线是可能的。
这是一个和我有同样问题的人,使用第二个命令,但显然可以用第一个命令解决它,所以我试图让这个命令运行。https://www.spigotmc.org/threads/how-to-import-net-minecraft-util.252371/。
如果我尝试包含这样的内容,我会看到com.google.common,com.oracle但是com.suncom.mojang 却无处可见。我发现它必须对您添加到项目中的 .jar 文件执行某些操作,但我不知道如何将 com.mojang... 放入可导入文件中。
小智 8
为了建立SPY_me 的答案,如果您使用 Gradle,这里是我的解决方案:
repositories {
// ...
maven {
name = 'minecraft-repo'
url = 'https://libraries.minecraft.net/'
// this lets gradle know where to look for authlib
}
}
dependencies {
// ...
compile 'com.mojang:authlib:1.5.21'
// this adds the library to the project and the jar when you compile your project
}
Run Code Online (Sandbox Code Playgroud)
如果你想直接下载这个库,这里是jar:
https://libraries.minecraft.net/com/mojang/authlib/1.5.21/authlib-1.5.21.jar
| 归档时间: |
|
| 查看次数: |
16569 次 |
| 最近记录: |