Minecraft Fabric Client 教程 #4 添加Modules

cn.enaium.excel下新建一个包module

module包里新建ModuleModuleManager这2个类 然后再新建一个Category枚举

Module内容

package cn.enaium.excel.module;

/**
 * @Author Enaium
 * @Date 2020/1/9 11:03
 */
public class Module {

    private String name;
    private Category category;

    private boolean toggled;


    public Module(String name,Category category) {
        this.name = name;
        this.category = category;
        this.toggled = false;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public boolean isToggled() {
        return toggled;
    }

    public void setToggled(boolean toggled) {
        this.toggled = toggled;
    }
}

ModuleManager 内容

package cn.enaium.excel.module;

import java.util.ArrayList;

/**
 * @Author Enaium
 * @Date 2020/1/9 11:03
 */
public class ModuleManager {
    ArrayList<Module> modules;

    public ModuleManager() {
        modules = new ArrayList();
    }

    private void addModule(Module e) {
        this.modules.add(e);
    }

    public void loadModules() {
        
    }
}

Category内容

package cn.enaium.excel.module;

/**
 * @Author Enaium
 * @Date 2020/1/9 11:03
 */
public enum Category {

    COMBAT,MOVEMENT,RENDER,OTHER;

}

然后再Excel里面添加Module

public enum Excel {
    [...]
    public ModuleManager moduleManager;

    public void onEnable() {
        [...]
        moduleManager = new ModuleManager();

        moduleManager.loadModules();
    }
    [...]
}