采集能力插件(Harvestability Plugin)
基本信息
| 属性 | 值 |
|---|---|
| 插件 uid | harvestability(HarvestabilityPlugin.java:22,常量 HarvestabilityIdentifiers.NAMESPACE_HARVESTABILITY,HarvestabilityIdentifiers.java:24) |
| 依赖 mod | 无(但内部 handler 按 mod 加载情况条件注册) |
| 配置分类 | plugins_autogen.harvestability |
| 注册调用 | 服务端 0 次 / 客户端 11 次 |
| 生效侧 | 仅客户端 |
功能
回答「这个方块现在能不能挖、要拿什么工具挖」——显示当前可采集状态、有效工具、采集等级,以及剪刀/精准采集等特殊获取方式。
这是 WDMla 中唯一做运行时 mod 条件注册的插件:它在 registerClient 里用 Mods 枚举的 isLoaded() 决定是否注册对应 mod 的采集判定器(HarvestabilityPlugin.registerClient)。因此其注册列表会随整合包内容变化。
registerHarvest 的目标类里包含 Block.class(通用兜底)与 BlockLiquid.class(液体)。BlockDragonEgg、BlockSnow、BlockSnowBlock、BlockWeb 四个类由同一个 VanillaSpecialHarvestHandler 覆盖。
注册内容
客户端(HarvestabilityPlugin.registerClient),全部为无条件项在前、条件项在后:
| 方法 | 目标类 | handler | 条件 |
|---|---|---|---|
registerBlockComponent |
Block |
HarvestToolProvider.INSTANCE |
无 |
registerHarvest |
Block |
BaseHarvestLogicHandler.INSTANCE |
无 |
registerHarvest |
Block |
VanillaHarvestToolHandler.INSTANCE |
无 |
registerHarvest |
Block |
TinkersHarvestHandler.INSTANCE |
Mods.TCONSTUCT.isLoaded() |
registerHarvest |
Block |
IguanaHarvestHandler.INSTANCE |
Mods.IGUANATWEAKS.isLoaded() |
registerHarvest |
Block |
GregTechHarvestHandler.INSTANCE |
Mods.GREGTECH.isLoaded() |
registerHarvest |
BlockLiquid |
LiquidHarvestHandler.INSTANCE |
无 |
registerHarvest |
BlockDragonEgg |
VanillaSpecialHarvestHandler.INSTANCE |
无 |
registerHarvest |
BlockSnow |
VanillaSpecialHarvestHandler.INSTANCE |
无 |
registerHarvest |
BlockSnowBlock |
VanillaSpecialHarvestHandler.INSTANCE |
无 |
registerHarvest |
BlockWeb |
VanillaSpecialHarvestHandler.INSTANCE |
无 |
三个条件项的 Mods 常量分别是 modid TConstruct、IguanaTweaksTConstruct、gregtech(Mods.java:19-23)。GREGTECH 的判据特殊:谓词是 version -> !Loader.isModLoaded("gregapi"),即检测到 gregapi 就跳过 GregTech 支持(Mods.java:21)。条件未满足时 Mods.isLoaded() 会打一条 info 日志说明跳过了哪些兼容类(Mods.java:57-63)。
对应的 Proxy 初始化在客户端 postInit 中按同样条件触发(ClientProxy.java:63-71),为 ProxyTinkersConstruct.init() / ProxyIguanaTweaks.init() / ProxyGregTech.init()。
数值
采集等级映射表见 插件配置 的 harvestability 段:TiC 6 档、IguanaTweaks 10 档,均为有效镐材料 ID,范围 1–100。TiC 表由 ProxyTinkersConstruct.java:58-63 读取,IT 表由 ProxyIguanaTweaks.java:41-50 读取(后者按注释覆盖前者,PluginsConfig.java:266-267)。
显示开关(PluginsConfig.java:322-422)分三组:
| 组 | 字段 | 默认 |
|---|---|---|
icon |
currentlyharvestableicon / notcurrentlyharvestablestring / shearabilityitem(minecraft:shears)/ silktouchabilityitem(minecraft:grass)/ effectivetoolicon / showshearabilityicon / showsilktouchabilityicon |
全 true |
icon |
coloriconwitheffectiveness / alwaysshowadditionaltools |
全 false |
text |
harvestlevelnum / harvestlevelname / effectivetoolline / currentlyharvestableline |
全 false |
condition |
oresonly / textdetailsonly / unharvestableonly / toolrequiredonly |
全 false |
condition 四项全为 false 意味着默认对所有方块显示采集行;打开 oresonly 后仅矿石方块显示。
采集信息可用 condition.textdetailsonly 限定为「仅在按住显示详细信息键时以纯文本显示」。