Skip to content
On this page

Fabric

ServerMobEffectEvent

top.katton.api.eventfabric/src/main/kotlin/top/katton/api/event/ServerMobEffectEvent.kt
Mob effect events for Fabric platform.

ServerMobEffectEvent

FabricObject
kotlin
object ServerMobEffectEvent

Mob effect events for Fabric platform.

This object provides events related to mob effects (potions) including adding, removing, and modifying effects on entities.

ServerMobEffectEvent.initialize

FabricFunction
kotlin
fun initialize()

Initializes the mob effect events by registering Fabric event handlers. This method should be called during mod initialization.

ServerMobEffectEvent.onAllowAdd

FabricProperty
kotlin
val onAllowAdd

Event triggered to allow or deny a mob effect being added to an entity.

Returns

true to allow the effect, false to cancel it.

ServerMobEffectEvent.onBeforeAdd

FabricProperty
kotlin
val onBeforeAdd

Event triggered before a mob effect is added to an entity. Use this for pre-processing or modification.

ServerMobEffectEvent.onAfterAdd

FabricProperty
kotlin
val onAfterAdd

Event triggered after a mob effect has been added to an entity.

ServerMobEffectEvent.onAllowEarlyRemove

FabricProperty
kotlin
val onAllowEarlyRemove

Event triggered to allow or deny early removal of a mob effect.

Returns

true to allow removal, false to cancel it.

ServerMobEffectEvent.onBeforeRemove

FabricProperty
kotlin
val onBeforeRemove

Event triggered before a mob effect is removed from an entity.

ServerMobEffectEvent.onAfterRemove

FabricProperty
kotlin
val onAfterRemove

Event triggered after a mob effect has been removed from an entity.

ServerMobEffectEvent.MobEffectAllowAddArg

FabricData Class
kotlin
data class MobEffectAllowAddArg(val entity: Entity, val effectInstance: MobEffectInstance, val context: EffectEventContext)

Argument class for mob effect allow-add events.

Properties

PropertyDescription
entityThe entity receiving the effect
effectInstanceThe effect instance being added
contextThe context of the effect event

ServerMobEffectEvent.MobEffectAddArg

FabricData Class
kotlin
data class MobEffectAddArg(val entity: Entity, val effectInstance: MobEffectInstance, val context: EffectEventContext)

Argument class for mob effect add events.

Properties

PropertyDescription
entityThe entity receiving the effect
effectInstanceThe effect instance being added
contextThe context of the effect event

ServerMobEffectEvent.MobEffectAllowEarlyRemoveArg

FabricData Class
kotlin
data class MobEffectAllowEarlyRemoveArg(val entity: Entity, val effectInstance: MobEffectInstance, val context: EffectEventContext)

Argument class for mob effect allow-early-remove events.

Properties

PropertyDescription
entityThe entity losing the effect
effectInstanceThe effect instance being removed
contextThe context of the effect event

ServerMobEffectEvent.MobEffectBeforeRemoveArg

FabricData Class
kotlin
data class MobEffectBeforeRemoveArg(val entity: Entity, val effectInstance: MobEffectInstance, val context: EffectEventContext)

Argument class for mob effect before-remove events.

Properties

PropertyDescription
entityThe entity losing the effect
effectInstanceThe effect instance being removed
contextThe context of the effect event

ServerMobEffectEvent.MobEffectAfterRemoveArg

FabricData Class
kotlin
data class MobEffectAfterRemoveArg(val entity: Entity, val effectInstance: MobEffectInstance, val context: EffectEventContext)

Argument class for mob effect after-remove events.

Properties

PropertyDescription
entityThe entity that lost the effect
effectInstanceThe effect instance that was removed
contextThe context of the effect event