User Tools

Site Tools


zh_cn:tutorial:setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
zh_cn:tutorial:setup [2023/06/01 01:30] – [手动步骤] solidblockzh_cn:tutorial:setup [2024/03/14 04:19] – [手动步骤] solidblock
Line 24: Line 24:
 运行 Gradle 任务 ''genSources''(生成源文件),如果你的 IDE 不集成 Gradle 支持的话则需要在控制台/终端/命令提示符中输入 ''gradlew genSources''(在 Linux 或 macOS 上则是 ''./gradlew genSources'' 运行 Gradle 任务 ''genSources''(生成源文件),如果你的 IDE 不集成 Gradle 支持的话则需要在控制台/终端/命令提示符中输入 ''gradlew genSources''(在 Linux 或 macOS 上则是 ''./gradlew genSources''
  
-如有需要,可以在 ''gradle.properties'' 中设置镜像源。镜像源可能有时不可用,或者内容更新滞后,因此如需暂时禁镜像下载,可暂时将相关内容注释掉即可。+如有需要,可以在 ''gradle.properties'' 中设置镜像源。镜像源可能有时不可用,或者内容更新滞后,如需使官方源,可暂时将相关内容注释掉即可。BMCLAPI 镜像缓慢时,可使用官方源,或参考[[https://mirrors.cernet.edu.cn/list/bmclapi|校园网联合镜像站]]
  
 <code properties> <code properties>
Line 48: Line 48:
     - 在 Gradle 页面里打开“Gradle 设置(Gradle Settings)”     - 在 Gradle 页面里打开“Gradle 设置(Gradle Settings)”
     - 将“使用此工具构建和运行(Build and run using)”和“使用此工具运行测试(Run tests using)”选项改成“IntelliJ IDEA”。     - 将“使用此工具构建和运行(Build and run using)”和“使用此工具运行测试(Run tests using)”选项改成“IntelliJ IDEA”。
-    - 进入 文件(File)-> 项目结构...(Project Structure...)-> 项目(Project)然后将模块编译输出路径(Project compiler output)改成 ''$PROJECT_DIR$/out'' 
  
 不幸的是,目前还不能给“使用此工具构建和运行”和“使用此工具运行测试”设置一个全 IDE 内的默认值,所以这些每创建一个新项目都得重复上述步骤。 不幸的是,目前还不能给“使用此工具构建和运行”和“使用此工具运行测试”设置一个全 IDE 内的默认值,所以这些每创建一个新项目都得重复上述步骤。
Line 55: Line 54:
  
 如果你使用 IntelliJ IDEA,你可以使用 [[https://plugins.jetbrains.com/plugin/8327|MinecraftDev 插件]]。该插件支持自动生成 Fabric 项目以及一些与 Mixin 有关的功能,如检查、生成访问器(accessor)和影子(shadow)字段、复制 Mixin 目标参考(JVM 描述符)。你可以在文件(File) → 设置(Settings) → 插件(Plugins)中打开内部插件浏览器,找到并安装这个插件,只需要在搜索框里搜索“Minecraft”,选择第一个结果安装即可。  如果你使用 IntelliJ IDEA,你可以使用 [[https://plugins.jetbrains.com/plugin/8327|MinecraftDev 插件]]。该插件支持自动生成 Fabric 项目以及一些与 Mixin 有关的功能,如检查、生成访问器(accessor)和影子(shadow)字段、复制 Mixin 目标参考(JVM 描述符)。你可以在文件(File) → 设置(Settings) → 插件(Plugins)中打开内部插件浏览器,找到并安装这个插件,只需要在搜索框里搜索“Minecraft”,选择第一个结果安装即可。 
 +
 +**注**:MCDev 插件中的模板会直接使用 loom 的最新不稳定版本,请小心使用。
  
 === Eclipse === === Eclipse ===
Line 85: Line 86:
 ==== 缺少声音 ==== ==== 缺少声音 ====
 有时当 IDE 在导入 Gradle 项目的时候有些游戏素材不会正常下载。如果遇到这种情况则要手动运行 ''downloadAssets'' 任务——既可以使用 IDE 的自带菜单也可以直接执行 ''gradlew downloadAssets'' 有时当 IDE 在导入 Gradle 项目的时候有些游戏素材不会正常下载。如果遇到这种情况则要手动运行 ''downloadAssets'' 任务——既可以使用 IDE 的自带菜单也可以直接执行 ''gradlew downloadAssets''
 +
 +==== 错误: 找不到或无法加载主类 net.fabricmc.devlaunchinjector.Main / 启动配置中“没有指定 SDK” ====
 +这可能是 Intellij IDEA 自近期更新 2023.2 后的一个 bug。要修复这个问题,删除整个 `.idea` 文件夹然后重启 Intellij IDEA 即可。模块会重新构建。你可能需要再次指定 Java 版本。如果重启之后没有运行配置,你可以运行 `gradle ideaSyncTask` 然后再检查一下。
  
 ==== java.lang.ClassNotFoundException: net.fabricmc.loader.impl.launch.knot.KnotClient / java.lang.TypeNotPresentException: Type net/minecraft/util/Identifier not present / java.lang.RuntimeException: Minecraft game provider couldn't locate the game! The game may be absent from the class path, lacks some expected files, suffers from jar corruption or is of an unsupported variety/version. ==== ==== java.lang.ClassNotFoundException: net.fabricmc.loader.impl.launch.knot.KnotClient / java.lang.TypeNotPresentException: Type net/minecraft/util/Identifier not present / java.lang.RuntimeException: Minecraft game provider couldn't locate the game! The game may be absent from the class path, lacks some expected files, suffers from jar corruption or is of an unsupported variety/version. ====
zh_cn/tutorial/setup.txt · Last modified: 2024/04/15 00:36 by solidblock