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).
Constructors
Section titled “Constructors”| Member | Description |
|---|---|
Constructor |
A status effect to apply to a player (a potion effect in Bukkit terms). |
Constructor
Section titled “Constructor”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. |
Fields
Section titled “Fields”| Member | Description |
|---|---|
const int Infinite = -1 |
The duration of an effect that never runs out. |
Infinite
Section titled “Infinite”public const int Infinite = -1;The duration of an effect that never runs out.
Properties
Section titled “Properties”| 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. |
Ambient
Section titled “Ambient”public bool Ambient { get; init; }Whether it comes from a beacon (translucent particles).
Amplifier
Section titled “Amplifier”public int Amplifier { get; init; }The level minus one: 0 is level I, 1 is level II, up to 255.
DurationTicks
Section titled “DurationTicks”public int DurationTicks { get; init; }How long it lasts in ticks (20 per second), or PotionEffect.Infinite.
Effect
Section titled “Effect”public string Effect { get; init; }The effect key, e.g. minecraft:speed (the namespace may be left out).
IsInfinite
Section titled “IsInfinite”public bool IsInfinite { get; }Whether the effect never runs out.
ShowIcon
Section titled “ShowIcon”public bool ShowIcon { get; init; }Whether the effect shows in the player’s HUD.
ShowParticles
Section titled “ShowParticles”public bool ShowParticles { get; init; }Whether the effect shows particles around the player.
Methods
Section titled “Methods”| 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