TargetedMod(目标 mod 枚举)

基本信息

属性 值
类 com.gtnewhorizons.angelica.mixins.TargetedMod
路径 src/main/java/com/gtnewhorizons/angelica/mixins/TargetedMod.java
枚举项数 28
声明 @Getter public enum TargetedMod implements ITargetMod(:7-8)
用途 Mixins 枚举里 addRequiredMod / addExcludedMod 的参数类型

这个枚举是 Angelica 识别「目标 mod 是否在场」的唯一途径。它携带的字符串不是 Angelica 的 modid,而是第三方 mod 的识别信息。

两种构造形式

构造 行 参数 语义
TargetedMod(String targetClass) :41-43 只有类名 按类探测,不设 modid
TargetedMod(String coreModClass, String modId) :44-46 coremod 类名 + modid 同时按 coremod 类与 modid 探测

27 项用双参形式,只有 NTM_SPACE 用单参形式(:25,"com.hbm.dim.SolarSystem")—— 它没有 modid 字段,只按类探测。

全部 28 项

枚举项 行 targetClass / coreModClass modid
ARCHAICFIX :10 org.embeddedt.archaicfix.ArchaicCore archaicfix
BACKHAND :11 xonin.backhand.coremod.BackhandLoadingPlugin backhand
CAMPFIRE_BACKPORT :12 null campfirebackport
CHISEL :13 null chisel
COFHCORE :14 cofh.asm.LoadingPlugin CoFHCore(驼峰)
CUBIC_CHUNKS :15 com.cardinalstar.cubicchunks.asm.coremod.CubicChunksCoreMod cubicchunks
DYNAMIC_SURROUNDINGS_MIST :16 org.blockartistry.mod.DynSurround.mixinplugin.DynamicSurroundingsEarlyMixins dsurround
DYNAMIC_SURROUNDINGS_ORIGINAL :17 org.blockartistry.mod.DynSurround.asm.TransformLoader dsurround
DRAGON_API :18 Reika.DragonAPI.Auxiliary.DragonAPIASMHandler DragonAPI(驼峰)
DRACONIC_EVOLUTION :19 null DraconicEvolution(驼峰)
ET_FUTURUM_REQUIEM :20 null etfuturum
EXTRAUTILS :21 null ExtraUtilities
FARSEEK :22 farseek.core.FarseekCoreMod farseek
FALSETWEAKS :23 com.falsepattern.falsetweaks.asm.CoreLoadingPlugin falsetweaks
MINEFACTORY_RELOADED :24 null MineFactoryReloaded(驼峰)
NTM_SPACE :25 com.hbm.dim.SolarSystem 无(单参构造)
IC2 :26 ic2.core.coremod.IC2core IC2(全大写缩写)
NATURA :27 null Natura
OPENBLOCKS :28 null OpenBlocks
SECURITYCRAFT :29 null securitycraft
STARMINER :30 jp.mc.ancientred.starminer.core.SMPlugin modJ_StarMiner(带后缀)
SUPERNOVA :31 com.mitchej123.supernova.core.SupernovaCore supernova
THAUMCRAFT :32 null Thaumcraft(首字母大写)
TINKERS_CONSTRUCT :33 null TConstruct
TWILIGHT_FOREST :34 null TwilightForest
BIOMES_O_PLENTY :35 null BiomesOPlenty
CUSTOM_PLAYER_MODELS :36 com.tom.cpmcore.CPMLoadingPlugin customplayermodels
WITCHERY :37 null witchery

这张表本身就是「modid 不能靠猜」的活样本:同一列里混着全小写、首字母大写、全大写缩写、带驼峰、带 _ 后缀等多种风格,且 14 项的 targetClass 是 null(只能靠 modid 探测)。

两种用法

Mixins.java 里通过 addRequiredMod / addExcludedMod 使用:

方法 语义 实际用例
addRequiredMod(TargetedMod.X) 该 mod 未装则整组 mixin 跳过 Mixins.java:83 addRequiredMod(TargetedMod.STARMINER)
addExcludedMod(TargetedMod.X) 该 mod 已装则整组 mixin 跳过 Mixins.java:76-77 排除 Dynamic Surroundings 的 Mist 与 Original 两个变体

DYNAMIC_SURROUNDINGS 被拆成 _MIST 与 _ORIGINAL 两项但共用同一个 modid dsurround —— 因为该 mod 有两代版本,coremod 类名不同,混装时需要分别探测。

与 CompatConfig 的关系

本枚举覆盖 28 个第三方 mod,但 CompatConfig 只有 9 个开关、CompatHandlers 枚举只有 5 项。两套机制的覆盖面差异很大:

机制 覆盖目标数 手段
TargetedMod 28 跳过 / 不跳过 mixin
CompatConfig 9 配置开关
CompatHandlers 5 ASM transformer

例如 NTM_SPACE 出现在 TargetedMod 里且有 late/client/ntmSpace 的 3 个 mixin 补丁,也有 CompatConfig.fixNTMSpace 开关,但没有对应的 ASM 兼容处理器。

相关条目