본문으로 건너뛰기
버전: Minecraft 26.2

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.

인자타입설명
idString—
listenerTypeClass<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).

상수설명
HIGHESTRuns first.
HIGHRuns before NORMAL.
NORMALThe default for EventRegistry.register(EventKey, Object).
LOWRuns after NORMAL.
LOWESTRuns 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.

인자타입설명
eventEventKey<L>—
listenerL—

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.

인자타입설명
eventEventKey<L>—
priorityEventPriority—
listenerL—

예외 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.

상수설명
PASSNo opinion: the next listener runs, and without a decision the game goes on as usual.
ALLOWLets the action happen and skips the remaining listeners (the game's own checks still apply).
DENYCancels 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

Buy me a coffee