Skip to content
On this page
Common

ScriptEntrypoint

top.katton.apicommon/src/main/kotlin/top/katton/api/ScriptEntrypoint.kt
Execution stages available to server entrypoints.

ServerPhase

ServerPhaseCommonEnum Class
kotlin
enum class ServerPhase

Execution stages available to server entrypoints.

ServerPhase.BOOTSTRAP

ServerPhase.BOOTSTRAPCommonClass
kotlin
BOOTSTRAP,

Early, process-lifetime initialization. Only GLOBAL packs may use this phase.

ServerPhase.READY

ServerPhase.READYCommonClass
kotlin
READY

A server and its worlds are available. GLOBAL and WORLD packs may use this phase.

ClientPhase

ClientPhaseCommonEnum Class
kotlin
enum class ClientPhase

Execution stages available to client entrypoints.

ClientPhase.READY

ClientPhase.READYCommonClass
kotlin
READY,

One-time client initialization. Only GLOBAL packs may use this phase.

ClientPhase.REGISTRY_SETUP

ClientPhase.REGISTRY_SETUPCommonClass
kotlin
REGISTRY_SETUP,

Client content registration before remote registry validation.

ClientPhase.JOINED

ClientPhase.JOINEDCommonClass
kotlin
JOINED

A client connection, player, and world are available.

InvocationReason

InvocationReasonCommonEnum Class
kotlin
enum class InvocationReason

Whether an entrypoint is running for the first time or being replayed after a reload.

InvocationReason.INITIAL_LOAD

InvocationReason.INITIAL_LOADCommonClass
kotlin
INITIAL_LOAD,

The entrypoint is running for the first time at its lifecycle boundary.

InvocationReason.HOT_RELOAD

InvocationReason.HOT_RELOADCommonClass
kotlin
HOT_RELOAD

The entrypoint is replaying after an accepted script reload or synchronized revision.

ReloadCause

ReloadCauseCommonEnum Class
kotlin
enum class ReloadCause

The operation that caused an entrypoint invocation.

ReloadCause.SERVER_START

ReloadCause.SERVER_STARTCommonClass
kotlin
SERVER_START,

A server reached its ready lifecycle boundary.

ReloadCause.COMMAND

ReloadCause.COMMANDCommonClass
kotlin
COMMAND,

A Katton command requested a script reload.

ReloadCause.DATAPACK_RELOAD

ReloadCause.DATAPACK_RELOADCommonClass
kotlin
DATAPACK_RELOAD,

Minecraft's datapack reload flow requested a script reload.

ReloadCause.SERVER_PACK_SYNC

ReloadCause.SERVER_PACK_SYNCCommonClass
kotlin
SERVER_PACK_SYNC,

A client activated a server-authoritative script-pack snapshot.

ReloadCause.CLIENT_JOIN

ReloadCause.CLIENT_JOINCommonClass
kotlin
CLIENT_JOIN

A client connection gained its local player and level.

ScriptInvocationContext

ScriptInvocationContextCommonInterface
kotlin
sealed interface ScriptInvocationContext

Common metadata supplied to phase-aware entrypoints.

BootstrapContext

BootstrapContextCommonData Class
kotlin
data class BootstrapContext( override val packId: String, override val scope: ScriptPackScope, override val reason: InvocationReason, override val cause: ReloadCause, override val platform: String ) : ScriptInvocationContext

Invocation metadata for [ServerPhase.BOOTSTRAP].

ServerReadyContext

ServerReadyContextCommonData Class
kotlin
data class ServerReadyContext( override val packId: String, override val scope: ScriptPackScope, override val reason: InvocationReason, override val cause: ReloadCause, override val platform: String, val server: MinecraftServer ) : ScriptInvocationContext

Invocation metadata for [ServerPhase.READY], including the available [server].

ClientReadyContext

ClientReadyContextCommonData Class
kotlin
data class ClientReadyContext( override val packId: String, override val scope: ScriptPackScope, override val reason: InvocationReason, override val cause: ReloadCause, override val platform: String, val client: Minecraft ) : ScriptInvocationContext

Invocation metadata for [ClientPhase.READY], including the available [client].

ClientRegistryContext

ClientRegistryContextCommonData Class
kotlin
data class ClientRegistryContext( override val packId: String, override val scope: ScriptPackScope, override val reason: InvocationReason, override val cause: ReloadCause, override val platform: String, val client: Minecraft ) : ScriptInvocationContext

Invocation metadata for [ClientPhase.REGISTRY_SETUP], before remote registry validation.

ClientJoinedContext

ClientJoinedContextCommonData Class
kotlin
data class ClientJoinedContext( override val packId: String, override val scope: ScriptPackScope, override val reason: InvocationReason, override val cause: ReloadCause, override val platform: String, val client: Minecraft, val player: LocalPlayer, val level: ClientLevel ) : ScriptInvocationContext

Invocation metadata for [ClientPhase.JOINED], including the available [player] and [level].

ClientScriptEntrypoint

ClientScriptEntrypointCommonAnnotation Class
kotlin
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FUNCTION)
annotation class ClientScriptEntrypoint( val phase: ClientPhase

Marks a top-level function as a client script entrypoint.

ServerScriptEntrypoint

ServerScriptEntrypointCommonAnnotation Class
kotlin
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FUNCTION)
annotation class ServerScriptEntrypoint( val phase: ServerPhase

Marks a top-level function as a server script entrypoint.