dev.polymodloader.api.event
이 페이지는 소스의 Javadoc에서 ./gradlew apiReference로 만든 것입니다. 설명은 코드에 적힌 영어 그대로입니다. 직접 고치지 말고 소스의 주석을 고친 뒤 다시 만드세요.
| 형식 | 종류 | 설명 |
|---|---|---|
EventKey | 클래스 | Identifies one event and the listener interface it calls. |
EventPriority | 열거형 | When a listener runs relative to the other listeners of the same event. |
EventRegistry | 인터페이스 | Registers event listeners for the calling mod. |
EventResult | 열거형 | The answer of a listener in a decision event, an event whose listeners may cancel or force what the game is about to do (for example BlockEvents.BREAK). |
EventKey
클래스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public final class EventKey<L>
Identifies one event and the listener interface it calls. Keys are compared by identity; each event has exactly one key constant, e.g. ServerEvents.STARTED.
of(String, Class<L>)
public static <L> EventKey<L> of(String id, Class<L> listenerType)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Creates a key; id is namespace:path and only used for diagnostics.
| 인자 | 타입 | 설명 |
|---|---|---|
id | String | — |
listenerType | Class<L> | — |
반환 EventKey<L>
id()
public String id()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Diagnostic ID, e.g. poly:server/started.
반환 String
listenerType()
public Class<L> listenerType()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The listener interface.
반환 Class<L>
EventPriority
열거형 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public enum EventPriority
When a listener runs relative to the other listeners of the same event. Listeners run from HIGHEST to LOWEST; listeners with the same priority run in registration order (and therefore, for listeners registered from entrypoints, in mod load order).
Use a higher priority to decide first in a decision event (for example a protection mod that refuses block breaking in claimed areas), a lower one to see what the others left alone. The levels have the same names and order as NeoForge's EventPriority; Fabric event phases map onto them (the default phase is NORMAL).
| 상수 | 설명 |
|---|---|
HIGHEST | Runs first. |
HIGH | Runs before NORMAL. |
NORMAL | The default for EventRegistry.register(EventKey, Object). |
LOW | Runs after NORMAL. |
LOWEST | Runs last. |
EventRegistry
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface EventRegistry
Registers event listeners for the calling mod. Obtained from ModContext.events().
register(EventKey<L>, L)
default <L> void register(EventKey<L> event, L listener)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Registers listener for event with EventPriority.NORMAL.
| 인자 | 타입 | 설명 |
|---|---|---|
event | EventKey<L> | — |
listener | L | — |
register(EventKey<L>, EventPriority, L)
<L> void register(EventKey<L> event, EventPriority priority, L listener)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Registers listener for event. Listeners run from EventPriority.HIGHEST to EventPriority.LOWEST; listeners with the same priority run in registration order. In decision events the first deciding listener ends the event (see EventResult).
Thread: any; registration is thread-safe. When: at any time, usually in an entrypoint; a listener registered while the event is being fired runs from the next firing on.
Failure: a listener that throws is reported with the mod ID and disabled (POLY-EVENT-001); other listeners and the game keep running.
| 인자 | 타입 | 설명 |
|---|---|---|
event | EventKey<L> | — |
priority | EventPriority | — |
listener | L | — |
예외 IllegalArgumentException — when listener does not implement the event's listener type
예외 NullPointerException — when an argument is null
EventResult
열거형 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public enum EventResult
The answer of a listener in a decision event, an event whose listeners may cancel or force what the game is about to do (for example BlockEvents.BREAK).
Convention (the same for every decision event): listeners run in EventPriority order; the first listener that returns ALLOW or DENY decides, and the listeners after it are not called. When every listener returns PASS, the game does what it would have done without Poly Mod Loader. A listener that throws counts as PASS and is disabled (POLY-EVENT-001); a listener that returns null is treated the same way (POLY-EVENT-003).
Interaction events use dev.polymodloader.api.world.InteractionResult instead, with the same rule: PASS lets the next listener run, anything else decides.
| 상수 | 설명 |
|---|---|
PASS | No opinion: the next listener runs, and without a decision the game goes on as usual. |
ALLOW | Lets the action happen and skips the remaining listeners (the game's own checks still apply). |
DENY | Cancels the action and skips the remaining listeners. |
isDecided()
public boolean isDecided()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether this result decides the event, i.e. is not PASS.
반환 boolean