Skip to content
On this page

Common

Effect

top.katton.api.registrycommon/src/main/kotlin/top/katton/api/registry/Effect.kt
Registers a native MobEffect with hot-reload support (String overload).

registerNativeEffect

CommonFunction
kotlin
fun registerNativeEffect(id: String, registerMode: RegisterMode = RegisterMode.AUTO, effectFactory: () -> MobEffect): KattonRegistry.KattonMobEffectEntry

Registers a native MobEffect with hot-reload support (String overload).

This is the primary API for registering custom MobEffect subclasses from scripts. The effect will be registered in the global Minecraft registry with full hot-reload capability.

Parameters

ParameterDescription
idEffect identifier (e.g., "mymod:custom_effect")
registerModeRegistration mode (GLOBAL, RELOADABLE, or AUTO)
effectFactoryFactory function to create the MobEffect instance

Returns

The registered KattonMobEffectEntry

registerNativeEffect

CommonFunction
kotlin
fun registerNativeEffect(id: Identifier, registerMode: RegisterMode = RegisterMode.AUTO, effectFactory: () -> MobEffect): KattonRegistry.KattonMobEffectEntry

Registers a native MobEffect with hot-reload support (Identifier overload).

Parameters

ParameterDescription
idEffect identifier
registerModeRegistration mode
effectFactoryFactory function to create the MobEffect instance

Returns

The registered KattonMobEffectEntry

createSimpleEffect

CommonFunction
kotlin
fun createSimpleEffect(category: MobEffectCategory, color: Int): MobEffect

Utility factory for quickly creating a simple custom MobEffect.

Creates a basic MobEffect with the specified category and color. For more complex effects, use the full factory pattern with registerNativeEffect.

Parameters

ParameterDescription
categoryThe effect category (BENEFICIAL, HARMFUL, or NEUTRAL)
colorThe effect color in RGB format

Returns

A new MobEffect instance