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 ​

registerNativeEffectCommonFunction
kotlin
fun registerNativeEffect(id: String, registerMode: RegisterMode = RegisterMode.WORLD, 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, WORLD, or RELOADABLE)
effectFactoryFactory function to create the MobEffect instance

Returns ​

registered KattonMobEffectEntry

registerNativeEffect ​

registerNativeEffectCommonFunction
kotlin
fun registerNativeEffect(id: Identifier, registerMode: RegisterMode = RegisterMode.WORLD, 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 ​

registered KattonMobEffectEntry

createSimpleEffect ​

createSimpleEffectCommonFunction
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 ​

new MobEffect instance