Skip to content

PotionEffect

Namespace Mc.Scripting · Kind struct (readonly)

public readonly struct PotionEffect : IEquatable<PotionEffect>

A status effect to apply to a player (a potion effect in Bukkit terms).

Member Description
Constructor A status effect to apply to a player (a potion effect in Bukkit terms).
public PotionEffect(string Effect, int DurationTicks, int Amplifier = 0, bool Ambient = false, bool ShowParticles = true, bool ShowIcon = true)

A status effect to apply to a player (a potion effect in Bukkit terms).

Parameters

Name Type Description
Effect string The effect key, e.g. minecraft:speed (the namespace may be left out).
DurationTicks int How long it lasts in ticks (20 per second), or PotionEffect.Infinite.
Amplifier int = 0 The level minus one: 0 is level I, 1 is level II, up to 255.
Ambient bool = false Whether it comes from a beacon (translucent particles).
ShowParticles bool = true Whether the effect shows particles around the player.
ShowIcon bool = true Whether the effect shows in the player’s HUD.
Member Description
const int Infinite = -1 The duration of an effect that never runs out.
public const int Infinite = -1;

The duration of an effect that never runs out.

Member Description
bool Ambient { get; init; } Whether it comes from a beacon (translucent particles).
int Amplifier { get; init; } The level minus one: 0 is level I, 1 is level II, up to 255.
int DurationTicks { get; init; } How long it lasts in ticks (20 per second), or PotionEffect.Infinite.
string Effect { get; init; } The effect key, e.g.
bool IsInfinite { get; } Whether the effect never runs out.
bool ShowIcon { get; init; } Whether the effect shows in the player’s HUD.
bool ShowParticles { get; init; } Whether the effect shows particles around the player.
public bool Ambient { get; init; }

Whether it comes from a beacon (translucent particles).

public int Amplifier { get; init; }

The level minus one: 0 is level I, 1 is level II, up to 255.

public int DurationTicks { get; init; }

How long it lasts in ticks (20 per second), or PotionEffect.Infinite.

public string Effect { get; init; }

The effect key, e.g. minecraft:speed (the namespace may be left out).

public bool IsInfinite { get; }

Whether the effect never runs out.

public bool ShowIcon { get; init; }

Whether the effect shows in the player’s HUD.

public bool ShowParticles { get; init; }

Whether the effect shows particles around the player.

Member Description
static PotionEffect For(string effect, TimeSpan duration, int amplifier = 0) Creates an effect lasting a number of seconds.
public static PotionEffect For(string effect, TimeSpan duration, int amplifier = 0)

Creates an effect lasting a number of seconds.

Parameters

Name Type Description
effect string The effect key.
duration TimeSpan How long it lasts.
amplifier int = 0 The level minus one.

Returns PotionEffect