SortableCandidate 接口

基本信息

属性 值
类型 普通 interface(非 @FunctionalInterface)
方法 getId(), getVersion(), getFile()

SortableCandidate 是 JarJar 排序器通用的候选对象抽象。ModCandidateV2Sorter<T extends SortableCandidate> 既能排序 ModContainerWrapper(mod 阶段),也能排序 APIOnlyWrapper(纯 API jar),还能排序 ModCandidateV2(coremod 阶段)。

接口定义

public interface SortableCandidate {
    String getId();
    DefaultArtifactVersion getVersion();
    File getFile();
}

实现类对比

实现类 getId getVersion getFile
ModContainerWrapper mod.getModId() new DefaultArtifactVersion(mod.getVersion()) mod.getSource()
APIOnlyWrapper candidate.getId() (delegated) candidate.getVersion() (delegated) candidate.getFile() (delegated)
ModCandidateV2 (本身) fmlCorePlugin/sourceFilename/modContainer.getName() version 字段 modContainer

ModContainerWrapper 还附加 getNestLevel()(不参与 SortableCandidate 通用接口,但被 MOD_COMPARATOR 与 COREMOD_COMPARATOR 显式消费)。

比较器

比较器 位置 顺序
MOD_COMPARATOR LoaderV2 id (case-insensitive) → version → nestLevel
COREMOD_COMPARATOR CoreModManagerV2 sortOrder → filename → version → nestLevel

相关条目