addEffect

fun LivingEntity.addEffect(type: PotionEffectType, duration: Duration, amplifier: Int = 0, ambient: Boolean = true, particles: Boolean = true, icon: Boolean = true)

Applies a potion effect to this living entity with the specified parameters.

The duration is automatically converted from Kotlin Duration to ticks (1 tick = 50ms).

Parameters

type

the type of potion effect to apply

duration

the duration of the effect

amplifier

the amplifier (level - 1) of the effect; defaults to 0

ambient

whether the effect is ambient (produces fewer particles); defaults to true

particles

whether to show particles; defaults to true

icon

whether to show the effect icon in the HUD; defaults to true