Git Product home page Git Product logo

coremodtutor's Introduction

Minecraft 1.3.2-1.15.2 原版 / FML CoreMod 开发教程

蓝色的链接表示这部分已写完,黑色的文本表示尚未完成。

教程在 GitHub 上开放 markdown 形式的源代码,希望可以请求给予一个star。

如果该教程以及其中的源代码存在问题或有其他疑问,欢迎通过 GitHub Issue 来提出。

这是一篇比较全面的 CoreMod 教程,也是对开发 CoreMod 过程的记录。请选择性阅读自己需要的部分,当然如果能有耐心阅读完所有内容当然是最好不过的。
原版 CoreMod 部分是从 FML 如何向 Minecraft 注入代码的角度进行分析,非必读内容;FML CoreMod 部分也可以直接阅读欲开发的版本。

版权声明

本教程作者为 xfl03 ,Mixin部分作者为ZekerZhayard 。感谢各位贡献者的辛勤付出,完整贡献者名单请参阅 GitHub

知识共享许可协议
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。

转载请附上GitHub地址:
https://github.com/xfl03/CoreModTutor

教程中的原创代码由MIT方式开源,可自由使用。
教程中使用的Forge代码为LGPL形式开源,版权属于Forge团队。

1 简介

3 原版 CoreMod

4 FML CoreMod

6 ASM

附录

coremodtutor's People

Contributors

forestbat avatar jihuayu avatar mouse0w0 avatar teddyxlandlee avatar xfl03 avatar zekerzhayard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

coremodtutor's Issues

疑似错误

关于tweak-mod中引用的replay mod的代码段。getReparseableCoremods是不是应该改成getIgnoredMods

CoreMods supports more target types after forge 1.14.3-27.0.16

CoreMods 0.6.2 开始支持新的 target type.

function initializeCoreMod() {
    return {
        "MethodTransformer": {
            "target": {
                "type": "METHOD",
                "class": "net.minecraft.client.Minecraft",
                "methodName": "func_1234_a",
                "methodDesc": "(Ljava/lang/String;)Z"
            },
            "transformer": function (method) {
                return method
            }
        },
        "FieldTransformer": {
            "target": {
                "type": "FIELD",
                "class": "net.minecraft.client.Minecraft",
                "fieldName": "field_5678_b"
            },
            "transformer": function (field) {
                return field
            }
        }
    }
}

关于文章的一些细节错误

简介-CoreMod-使用FML等ModLoader的原因
有一行文字表述不清
CoreMod可以通过修改其他类的行为是直接修改文件还是在运行时动态修改分为两种类型


Java虚拟机-ByteCode字节码
文章无内容


原版CoreMod-LaunchWrapper-加载流程
代码有误

final URLClassLoader ucl = (URLClassLoader) getClass().getClassLoader();
classLoader = new LaunchClassLoader(ucl.getURLs());
...
Thread.currentThread().setContextClassLoader(classLoader);
  • 由于从Java9开始,不再默认使用URLClassLoader而是AppClassLoader,在Java9及以上的版本这一行代码会发生ClassCastException导致游戏崩溃,直到ModLauncher才修复了这一问题
final URLClassLoader ucl = (URLClassLoader) getClass().getClassLoader();

后半段代码没有修改(实际上我也不知道后面这个代码块到底是想要指出错误代码还是贴出修复后的代码,所以不确定这个到底是不是错误)


原版CoreMod-ModLauncher-使用Forge加载
表述有误

从Forge 1.13.2-25.0.216开始,可以使用Forge来加载无论是否包含普通Mod的ModLauncher CoreMod。

“无论是否”听起来有些别扭,可能无法清晰表述愿意。


关于文章5.6节mixin部分扩展内容的一点问题

5.6节中向《目标类中添加类成员》部分
使用接口添加字段时,若接口与位于mixinconfig中指定的包或其子包中会使该接口类被标记为invalidClass导致无法加载
(推测位于mixinconfig指定包及其子包内的所有类均会被标记为invalidClass,未验证)
请求在文章相应部分(代码中的package部分)修改内容并注明此特性。

ModLauncher下同一个mod包含coremod和fmlmod

LaunchWrapper时期,可通过设置manifest的FMLCorePluginContainsFMLMod为true来使一个mod同时被当做coremod与普通mod去加载,然而此配置似乎在ModLauncher下不再生效。
观察到本指导提到"从Forge 1.13.2-25.0.216开始,可以使用Forge来加载无论是否包含普通Mod的ModLauncher CoreMod",而且万用皮肤补丁在高版本下单一mod兼顾了coremod与普通mod,请问是如何做到的呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.