MobEffectInstance

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.entity.effect.MobEffectInstance;

Description

A MobEffectInstance is a wrapper around a MobEffect that has a duration, amplifier, and other properties.

Implements

Undocumented Interfaces

Comparable<MobEffectInstance>

Members

Getter
Gets whether the MobEffectInstance is ambient.
script.zs
// MobEffectInstance.ambient as bool
myMobEffectInstance.ambient

Return Type: bool

ambient() as bool
Gets whether the MobEffectInstance is ambient.

Returns: True if the MobEffectInstance is ambient, false otherwise.

script.zs
// MobEffectInstance.ambient() as bool;
myMobEffectInstance.ambient();

Return Type: bool

Getter
Gets the amplifier of the MobEffectInstance.
script.zs
// MobEffectInstance.amplifier as int
myMobEffectInstance.amplifier

Return Type: int

amplifier() as int
Gets the amplifier of the MobEffectInstance.

Returns: The amplifier of the MobEffectInstance.

script.zs
// MobEffectInstance.amplifier() as int;
myMobEffectInstance.amplifier();

Return Type: int

compareTo(other as MobEffectInstance) as int
Compares the MobEffectInstance to another MobEffectInstance.

Returns: The result of the comparison.

script.zs
// MobEffectInstance.compareTo(other as MobEffectInstance) as int;
myMobEffectInstance.compareTo(myMobEffectInstance);

Parameters:

other Type: MobEffectInstance - The MobEffectInstance to compare to.

Return Type: int

Getter
Gets the description ID of the MobEffectInstance.
script.zs
// MobEffectInstance.descriptionId as string
myMobEffectInstance.descriptionId

Return Type: string

descriptionId() as string
Gets the description ID of the MobEffectInstance.

Returns: The description ID of the MobEffectInstance.

script.zs
// MobEffectInstance.descriptionId() as string;
myMobEffectInstance.descriptionId();

Return Type: string

Getter
Gets the duration of the MobEffectInstance.
script.zs
// MobEffectInstance.duration as int
myMobEffectInstance.duration

Return Type: int

duration() as int
Gets the duration of the MobEffectInstance.

Returns: The duration of the MobEffectInstance.

script.zs
// MobEffectInstance.duration() as int;
myMobEffectInstance.duration();

Return Type: int

Getter
Gets the MobEffect of the MobEffectInstance.
script.zs
// MobEffectInstance.effect as MobEffect
myMobEffectInstance.effect

Return Type: MobEffect

effect() as MobEffect
Gets the MobEffect of the MobEffectInstance.

Returns: The MobEffect of the MobEffectInstance.

script.zs
// MobEffectInstance.effect() as MobEffect;
myMobEffectInstance.effect();

Return Type: MobEffect

static load(data as MapData) as MobEffectInstance
Loads a MobEffectInstance from a MapData.

Returns: The MobEffectInstance loaded from the MapData.

script.zs
// MobEffectInstance.load(data as MapData) as MobEffectInstance;
MobEffectInstance.load(myMapData);

Parameters:

data Type: MapData - The MapData to load the MobEffectInstance from.

Return Type: MobEffectInstance

static of(mobEffect as MobEffect, duration as int = 0, amplifier as int = 0, ambient as bool = false, visible as bool = true, showIcon as bool = true, hiddenEffect as MobEffectInstance = null) as MobEffectInstance
Creates a new MobEffectInstance.

Returns: A new MobEffectInstance.

script.zs
// MobEffectInstance.of(mobEffect as MobEffect, duration as int = 0, amplifier as int = 0, ambient as bool = false, visible as bool = true, showIcon as bool = true, hiddenEffect as MobEffectInstance = null) as MobEffectInstance;
MobEffectInstance.of(myMobEffect, myInt, myInt, myBool, myBool, myBool, myMobEffectInstance);

Parameters:

mobEffect Type: MobEffect - The MobEffect to create the instance for.
duration (optional) Type: int - The duration of the effect.

Default Value: 0

amplifier (optional) Type: int - The amplifier of the effect.

Default Value: 0

ambient (optional) Type: bool - Whether the effect is ambient.

Default Value: false

visible (optional) Type: bool - Whether the effect is visible.

Default Value: true

showIcon (optional) Type: bool - Whether the effect should show an icon.

Default Value: true

hiddenEffect (optional) Type: MobEffectInstance - The hidden effect of the effect.

Default Value: null

Return Type: MobEffectInstance

save() as MapData
Saves the MobEffectInstance to a MapData.

Returns: The MapData representation of the MobEffectInstance.

script.zs
// MobEffectInstance.save() as MapData;
myMobEffectInstance.save();

Return Type: MapData

Getter
Gets whether the MobEffectInstance should show an icon.
script.zs
// MobEffectInstance.showIcon as bool
myMobEffectInstance.showIcon

Return Type: bool

showIcon() as bool
Gets whether the MobEffectInstance should show an icon.

Returns: True if the MobEffectInstance should show an icon, false otherwise.

script.zs
// MobEffectInstance.showIcon() as bool;
myMobEffectInstance.showIcon();

Return Type: bool

tick(entity as LivingEntity, onFinish as Runnable = null) as bool
Ticks the MobEffectInstance for the given LivingEntity.

Returns: True if the MobEffectInstance was ticked, false otherwise.

script.zs
// MobEffectInstance.tick(entity as LivingEntity, onFinish as Runnable = null) as bool;
myMobEffectInstance.tick(myLivingEntity, myRunnable);

Parameters:

entity Type: LivingEntity - The LivingEntity to tick the MobEffectInstance for.
onFinish (optional) Type: Runnable - The Runnable to run when the MobEffectInstance finishes.

Default Value: null

Return Type: bool

update(instance as MobEffectInstance) as bool
Updates the MobEffectInstance with the given MobEffectInstance.

Returns: True if the MobEffectInstance was updated, false otherwise.

script.zs
// MobEffectInstance.update(instance as MobEffectInstance) as bool;
myMobEffectInstance.update(myMobEffectInstance);

Parameters:

instance Type: MobEffectInstance - The MobEffectInstance to update with.

Return Type: bool

Getter
Gets whether the MobEffectInstance is visible.
script.zs
// MobEffectInstance.visible as bool
myMobEffectInstance.visible

Return Type: bool

visible() as bool
Gets whether the MobEffectInstance is visible.

Returns: True if the MobEffectInstance is visible, false otherwise.

script.zs
// MobEffectInstance.visible() as bool;
myMobEffectInstance.visible();

Return Type: bool