dev.polymodloader.api.lifecycle
이 페이지는 소스의 Javadoc에서 ./gradlew apiReference로 만든 것입니다. 설명은 코드에 적힌 영어 그대로입니다. 직접 고치지 말고 소스의 주석을 고친 뒤 다시 만드세요.
| 형식 | 종류 | 설명 |
|---|---|---|
ClientModInitializer | 함수형 인터페이스 | Entrypoint listed under entrypoints.client in poly.mod.json. |
CommonModInitializer | 함수형 인터페이스 | Entrypoint listed under entrypoints.common in poly.mod.json. |
DedicatedServerModInitializer | 함수형 인터페이스 | Entrypoint listed under entrypoints.server in poly.mod.json. |
LoadedMods | 인터페이스 | The mods loaded in this game, of every loader: Poly Mods, the mods of other loaders that Poly Mod Loader runs (Fabric), and the mods a host loader runs (MinecraftForge's, when Forge runs the game, ADR-0021). |
LoadedMods.Mod | 레코드 | One loaded mod. |
ModContext | 인터페이스 | Information Poly Mod Loader hands to a mod entrypoint about the mod being initialised and the process it runs in. |
ClientModInitializer
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ClientModInitializer
Entrypoint listed under entrypoints.client in poly.mod.json. Runs only on the client, after every CommonModInitializer. Same timing and failure rules as CommonModInitializer.
onInitializeClient(ModContext)
void onInitializeClient(ModContext context)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Initialises the mod's client-only parts.
| 인자 | 타입 | 설명 |
|---|---|---|
context | ModContext | — |
CommonModInitializer
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface CommonModInitializer
Entrypoint listed under entrypoints.common in poly.mod.json. Runs on both the client and the dedicated server.
Timing: called once on the main thread after all mods were discovered, validated, and ordered by their dependencies, and before Minecraft's own main starts. Minecraft registries and game objects do not exist yet at this point.
Failure: an exception stops the launch and is reported with the mod ID.
onInitializeCommon(ModContext)
void onInitializeCommon(ModContext context)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Initialises the mod's common (side-independent) parts.
| 인자 | 타입 | 설명 |
|---|---|---|
context | ModContext | — |
DedicatedServerModInitializer
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface DedicatedServerModInitializer
Entrypoint listed under entrypoints.server in poly.mod.json. Runs only on a dedicated server, after every CommonModInitializer. Same timing and failure rules as CommonModInitializer.
onInitializeDedicatedServer(ModContext)
void onInitializeDedicatedServer(ModContext context)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Initialises the mod's dedicated-server-only parts.
| 인자 | 타입 | 설명 |
|---|---|---|
context | ModContext | — |
LoadedMods
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.18
public interface LoadedMods
The mods loaded in this game, of every loader: Poly Mods, the mods of other loaders that Poly Mod Loader runs (Fabric), and the mods a host loader runs (MinecraftForge's, when Forge runs the game, ADR-0021). A Poly Mod reads it to switch an optional integration on or off, as Fabric mods use FabricLoader.isModLoaded and Forge mods ModList.isLoaded.
Only loaded mods are listed: mods that were blocked or left out are not, nor are the game, Java and the loaders themselves (minecraft, java, fabricloader, forge).
When: complete from the first entrypoint on; the list does not change while the game runs.
Thread: safe to read from any thread.
Implementations are provided by Poly Mod Loader; mods do not implement this interface.
isLoaded(String)
boolean isLoaded(String modId)
추가된 버전 0.1.0-alpha.18
Whether a mod with modId is loaded, by its own ID or an ID it provides (provides in fabric.mod.json).
| 인자 | 타입 | 설명 |
|---|---|---|
modId | String | — |
반환 boolean
find(String)
Optional<LoadedMods.Mod> find(String modId)
추가된 버전 0.1.0-alpha.18
The loaded mod with modId: the mod whose own ID it is, otherwise the first mod that provides it; empty when none is loaded.
| 인자 | 타입 | 설명 |
|---|---|---|
modId | String | — |
반환 Optional<LoadedMods.Mod>
all()
List<LoadedMods.Mod> all()
추가된 버전 0.1.0-alpha.18
Every loaded mod: first those a host loader runs, then the others in the order their entrypoints run.
반환 List<LoadedMods.Mod>
LoadedMods.Mod
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.18
public static record Mod(String modId, String version, String name, String loader, List<String> providedIds)
One loaded mod.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
modId | String | its ID |
version | String | its version text, as its own metadata declares it |
name | String | its display name |
loader | String | the loader that runs it, in lower case: poly, fabric, minecraftforge; more loaders may appear in later versions |
providedIds | List<String> | further IDs it answers to |
ModContext
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ModContext
Information Poly Mod Loader hands to a mod entrypoint about the mod being initialised and the process it runs in. Implementations are provided by Poly Mod Loader; mods do not implement this interface.
modId()
String modId()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The mod ID declared in poly.mod.json, for example minimal_native_mod.
반환 String
modVersion()
String modVersion()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The mod version declared in poly.mod.json.
반환 String
side()
GameSide side()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether this process is a client or a dedicated server.
반환 GameSide
mods()
LoadedMods mods()
추가된 버전 0.1.0-alpha.18
The mods loaded in this game, of every loader (Poly Mods, Fabric mods, Forge mods).
반환 LoadedMods
systems()
SystemLookup systems()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The active implementation of each Poly Mod Loader system, after replacements were applied.
반환 SystemLookup
events()
EventRegistry events()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Registers event listeners owned by this mod.
반환 EventRegistry
onShutdown(String, Runnable)
void onShutdown(String description, Runnable task)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Registers work to run when the game process exits.
Order: tasks run once, in reverse registration order across all mods, so mods are cleaned up before the mods they depend on.
Thread: tasks run on Poly Mod Loader's shutdown thread while the JVM exits. They must be quick, must not start new threads, and must not touch game state, which may already be gone.
Failure: an exception is logged with the mod ID (POLY-SHUTDOWN-001); the remaining tasks still run.
| 인자 | 타입 | 설명 |
|---|---|---|
description | String | what the task cleans up, shown in diagnostics |
task | Runnable | the work |
예외 IllegalStateException — when called after shutdown has started
configDirectory()
Path configDirectory()
추가된 버전 0.1.0-alpha.4 또는 그 이전
This mod's configuration directory, config/<mod id> in the game directory; created on first call. Configuration file formats are up to the mod.
반환 Path
content()
ContentRegistrar content()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Declares this mod's blocks and items (common entrypoints only).
반환 ContentRegistrar
commands()
CommandRegistrar commands()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Registers this mod's server commands.
반환 CommandRegistrar
network()
NetworkRegistrar network()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Declares this mod's network channels.
반환 NetworkRegistrar
worldgen()
WorldgenRegistrar worldgen()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Attaches this mod's placed features to biomes.
반환 WorldgenRegistrar
gameTests()
GameTestRegistrar gameTests()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Registers this mod's in-game tests.
반환 GameTestRegistrar
client()
ClientRegistrar client()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Client-only registrations: key bindings and HUD layers.
반환 ClientRegistrar
예외 IllegalStateException — on a dedicated server (POLY-CLIENT-001)
resources()
ResourceRegistrar resources()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Reload listeners for the mod's own data and asset files.
반환 ResourceRegistrar
permissions()
PermissionRegistrar permissions()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The mod's permissions and permission providers.
반환 PermissionRegistrar