架设Minecraft mod开发环境

栏目: 编程工具 · 发布时间: 5年前

内容简介:说了好几次要去学MC Mod开发,但是最后都咕咕咕了(好吧这次也没准会咕),今天在我内心对未知的强烈渴望的驱动之下,打开了IDEA,开工~好吧,作为一个从未开发过Java项目,或者说,连gradle都没听说过的一只小白来说,刚下载好MDK后,我蒙了,还好官方有详细的文档,我们来看下边这段:全英文!!!没事我看。。。看得懂的。大体上就是下载好MDK并解压,然后移动下面四个文件

说了好几次要去学MC Mod开发,但是最后都咕咕咕了(好吧这次也没准会咕),今天在我内心对未知的强烈渴望的驱动之下,打开了IDEA,开工~

好吧,作为一个从未开发过 Java 项目,或者说,连gradle都没听说过的一只小白来说,刚下载好MDK后,我蒙了,还好官方有详细的文档,我们来看下边这段:

  1. Obtain a source distribution from forge’s files site. (Look for the Mdk file type, or Src in older 1.8/1.7 versions).
  2. Extract the downloaded source distribution to an empty directory. You should see a bunch of files, and an example mod is placed in src/main/java for you to look at. Only a few of these files are strictly necessary for mod development, and you may reuse these files for all your projects These files are:
    build.gradle
    gradlew.bat
    gradlew
    gradle
    
  3. Move the files listed above to a new folder, this will be your mod project folder.
  4. Open up a command prompt in the folder you created in step (3), then run gradlew setupDecompWorkspace . This will download a bunch of artifacts from the internet needed to decompile and build Minecraft and forge. This might take some time, as it will download stuff and then decompile Minecraft. Note that, in general, these things will only need to be downloaded and decompiled once, unless you delete the gradle artifact cache.
  5. Choose your IDE: Forge explicitly supports developing with Eclipse or IntelliJ environments, but any environment, from Netbeans to vi/emacs, can be made to work.
    gradlew eclipse
    
  6. Load your project into your IDE.
    gradlew genIntellijRuns
    

全英文!!!没事我看。。。看得懂的。大体上就是下载好MDK并解压,然后移动下面四个文件

build.gradle
gradlew.bat
gradlew
gradle

到一个新的文件夹中组建你的新项目,然后跑命令行初始化,然后选IDE,然后。。。。

等待,实际上没有那么的复杂。我使用了IDEA,于是从步骤四开始是这样的:

  1. Launch IDEA and choose to open/import the build.gradle file, using the default gradle wrapper choice. While you wait for this process to finish, you can open the gradle panel, which will get filled with the gradle tasks once importing is completed.
  2. Run the setupDecompWorkspace task (inside the forgegradle task group). It will take a few minutes, and use quite a bit of RAM. If it fails, you can add -Xmx3G to the Gradle VM options in IDEA’s gradle settings window, or edit your global gradle properties.
  3. Once the setup task is done, you will want to run the genIntellijRuns task, which will configure the project’s run/debug targets.
  4. After it’s done, you should click the blue refresh icon on the gradle panel (there’s another refresh icon on the main toolbar, but that’s not it). This will re-synchronize the IDEA project with the Gradle data, making sure that all the dependencies and settings are up to date.

打开IDEA,打开你新创建的文件夹中的build.gradle,然后运行几个task(在gradle选项卡中)

setupDecompWorkspace
genIntellijRuns

一切都结束了之后,我们把src文件夹也复制过去,里边有一个示例Mod,然后跑 runClient 就好了~

注:关于调试,只要环境搭好了,直接就可以调试的(逃


以上所述就是小编给大家介绍的《架设Minecraft mod开发环境》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

一站式学习C编程

一站式学习C编程

宋劲杉 / 电子工业出版社 / 2011-3 / 59.00元

《一站式学习c编程》有两条线索,一条线索是以linux平台为载体全面深入地介绍c语言的语法和程序的工作原理,另一条线索是介绍程序设计的基本思想和开发调试方法。本书分为两部分:第一部分讲解编程语言和程序设计的基本思想方法,让读者从概念上认识c语言;第二部分结合操作系统和体系结构的知识讲解程序的工作原理,让读者从本质上认识c语言。 《一站式学习c编程》适合做零基础的初学者学习c语言的第一本教材,......一起来看看 《一站式学习C编程》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具