Skip to content

Class endstone::Effect

ClassList > endstone > Effect

Represents an effect that can be added to a Mob .More...

  • #include <endstone/potion/effect.h>

Public Functions

Type Name
constexpr Effect (EffectId type, std::optional< int > duration, int amplifier, bool ambient=false, bool particles=true, bool icon=true)
Creates an effect.
constexpr int getAmplifier () noexcept const
Gets the amplifier of this effect.
constexpr std::optional< int > getDuration () noexcept const
Gets the duration of this effect, in ticks.
constexpr EffectId getType () noexcept const
Gets the type of this effect.
constexpr bool hasIcon () noexcept const
Gets whether this effect has an icon.
constexpr bool hasParticles () noexcept const
Gets whether this effect has particles.
constexpr bool isAmbient () noexcept const
Makes the effect produce more, translucent, particles.
constexpr bool isInfinite () noexcept const
Returns whether this effect has an infinite duration.
constexpr bool operator!= (const Effect & other) noexcept const
constexpr bool operator== (const Effect & other) noexcept const

Detailed Description

An effect is an immutable description of an effect type together with a duration, amplifier and a set of display options. Applying it to a Mob (e.g. via Mob::addEffect) installs the effect; querying a Mob's active effects yields Effect values describing what is currently in force.

Public Functions Documentation

function Effect

Creates an effect.

inline constexpr endstone::Effect::Effect (
    EffectId type,
    std::optional< int > duration,
    int amplifier,
    bool ambient=false,
    bool particles=true,
    bool icon=true
) 

Parameters:


function getAmplifier

Gets the amplifier of this effect.

inline constexpr  int endstone::Effect::getAmplifier () noexcept const

A higher amplifier means the effect happens more often over its duration and in some cases has more effect on its target.

Returns:

the amplifier


function getDuration

Gets the duration of this effect, in ticks.

inline constexpr std::optional< int > endstone::Effect::getDuration () noexcept const

Returns:

the duration in ticks, or std::nullopt if this effect is infinite


function getType

Gets the type of this effect.

inline constexpr  EffectId endstone::Effect::getType () noexcept const

Returns:

the type


function hasIcon

Gets whether this effect has an icon.

inline constexpr  bool endstone::Effect::hasIcon () noexcept const

Returns:

whether this effect has an icon


function hasParticles

Gets whether this effect has particles.

inline constexpr  bool endstone::Effect::hasParticles () noexcept const

Returns:

whether this effect has particles


function isAmbient

Makes the effect produce more, translucent, particles.

inline constexpr  bool endstone::Effect::isAmbient () noexcept const

Returns:

whether this effect is ambient


function isInfinite

Returns whether this effect has an infinite duration.

inline constexpr  bool endstone::Effect::isInfinite () noexcept const

Effects with an infinite duration never expire unless manually removed.

Returns:

whether this effect is infinite


function operator!=

inline constexpr  bool endstone::Effect::operator!= (
    const  Effect & other
) noexcept const

function operator==

inline constexpr  bool endstone::Effect::operator== (
    const  Effect & other
) noexcept const


The documentation for this class was generated from the following file include/endstone/potion/effect.h