object ServerMobEffectEventMob effect events for Fabric platform.
This object provides events related to mob effects (potions) including adding, removing, and modifying effects on entities.
ServerMobEffectEvent.initialize
fun initialize()Initializes the mob effect events by registering Fabric event handlers. This method should be called during mod initialization.
ServerMobEffectEvent.onAllowAdd
val onAllowAddEvent 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
val onBeforeAddEvent triggered before a mob effect is added to an entity. Use this for pre-processing or modification.
ServerMobEffectEvent.onAfterAdd
val onAfterAddEvent triggered after a mob effect has been added to an entity.
ServerMobEffectEvent.onAllowEarlyRemove
val onAllowEarlyRemoveEvent triggered to allow or deny early removal of a mob effect.
Returns
true to allow removal, false to cancel it.
ServerMobEffectEvent.onBeforeRemove
val onBeforeRemoveEvent triggered before a mob effect is removed from an entity.
ServerMobEffectEvent.onAfterRemove
val onAfterRemoveEvent triggered after a mob effect has been removed from an entity.
ServerMobEffectEvent.MobEffectAllowAddArg
data class MobEffectAllowAddArg(val entity: Entity, val effectInstance: MobEffectInstance, val context: EffectEventContext)Argument class for mob effect allow-add events.
Properties
| Property | Description |
|---|---|
entity | The entity receiving the effect |
effectInstance | The effect instance being added |
context | The context of the effect event |
ServerMobEffectEvent.MobEffectAddArg
data class MobEffectAddArg(val entity: Entity, val effectInstance: MobEffectInstance, val context: EffectEventContext)Argument class for mob effect add events.
Properties
| Property | Description |
|---|---|
entity | The entity receiving the effect |
effectInstance | The effect instance being added |
context | The context of the effect event |
ServerMobEffectEvent.MobEffectAllowEarlyRemoveArg
data class MobEffectAllowEarlyRemoveArg(val entity: Entity, val effectInstance: MobEffectInstance, val context: EffectEventContext)Argument class for mob effect allow-early-remove events.
Properties
| Property | Description |
|---|---|
entity | The entity losing the effect |
effectInstance | The effect instance being removed |
context | The context of the effect event |
ServerMobEffectEvent.MobEffectBeforeRemoveArg
data class MobEffectBeforeRemoveArg(val entity: Entity, val effectInstance: MobEffectInstance, val context: EffectEventContext)Argument class for mob effect before-remove events.
Properties
| Property | Description |
|---|---|
entity | The entity losing the effect |
effectInstance | The effect instance being removed |
context | The context of the effect event |
ServerMobEffectEvent.MobEffectAfterRemoveArg
data class MobEffectAfterRemoveArg(val entity: Entity, val effectInstance: MobEffectInstance, val context: EffectEventContext)Argument class for mob effect after-remove events.
Properties
| Property | Description |
|---|---|
entity | The entity that lost the effect |
effectInstance | The effect instance that was removed |
context | The context of the effect event |