API 参考 / 能力接口(capability 包)
怎么拿到能力
| 能力接口 | 获取方式 | 可用时机 |
|---|---|---|
CapabilityRegistry | ctx.capabilities() | 进程级 |
ModManagerAccess | ModContext.capabilities().get(ModManagerAccess.class)(onInit 中取用);经事件总线在任意场景亦可获取 | 进程级 |
ModServiceRegistry | ctx.modServices() | 进程级 |
NetworkAccess | ctx.network() | 进程级 |
UiCustomization | ctx.uiCustomization() | 进程级(游戏启动后任意时刻可用) |
GlobalHotkeys | ctx.hotkeys() | 进程级 |
SceneHost | ctx.capabilities().get(SceneHost.class) | 进程级(全局常驻,不依赖游玩场景) |
StoryAccess | ctx.capabilities().get(StoryAccess.class) | 进程级 |
GameStateAccess | ctx.capabilities().get(GameStateAccess.class) | 游玩中 |
InputAccess | ctx.capabilities().get(InputAccess.class) | 游玩中 |
AudioAccess | ctx.capabilities().get(AudioAccess.class) | 游玩中 |
GameplayHud | GameplayMod.createGameplayHud(),或 ctx.capabilities().register(GameplayHud.class, ...) | 游玩中 |
LaneInputMapper | GameplayMod.createLaneInputMapper() | 游玩中 |
ModContext 上与本包相关的入口声明:
java
CapabilityRegistry capabilities();
ModServiceRegistry modServices();
NetworkAccess network();
UiCustomization uiCustomization();
GlobalHotkeys hotkeys();GameplayMod 上与游玩能力相关的钩子声明:
java
public interface GameplayMod extends Mod {
default boolean replacesDisorderProgressBar();
default GameplayHud createGameplayHud();
default LaneInputMapper createLaneInputMapper();
}