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

ServerMobEffectEventFabricObject
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

ServerMobEffectEvent.initializeFabricFunction
kotlin
fun initialize()

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

ServerMobEffectEvent.onAllowAdd

ServerMobEffectEvent.onAllowAddFabricProperty
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

ServerMobEffectEvent.onBeforeAddFabricProperty
kotlin
val onBeforeAdd

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

ServerMobEffectEvent.onAfterAdd

ServerMobEffectEvent.onAfterAddFabricProperty
kotlin
val onAfterAdd

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

ServerMobEffectEvent.onAllowEarlyRemove

ServerMobEffectEvent.onAllowEarlyRemoveFabricProperty
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

ServerMobEffectEvent.onBeforeRemoveFabricProperty
kotlin
val onBeforeRemove

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

ServerMobEffectEvent.onAfterRemove

ServerMobEffectEvent.onAfterRemoveFabricProperty
kotlin
val onAfterRemove

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

ServerMobEffectEvent.MobEffectAllowAddArg

ServerMobEffectEvent.MobEffectAllowAddArgFabricData 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

ServerMobEffectEvent.MobEffectAddArgFabricData 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

ServerMobEffectEvent.MobEffectAllowEarlyRemoveArgFabricData 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

ServerMobEffectEvent.MobEffectBeforeRemoveArgFabricData 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

ServerMobEffectEvent.MobEffectAfterRemoveArgFabricData 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