Class PotionEffect

    • Constructor Detail

      • PotionEffect

        public PotionEffect​(@NotNull
                            PotionEffectType type,
                            int duration,
                            int amplifier,
                            boolean ambient,
                            boolean particles,
                            boolean icon)
        Creates a potion effect.
        Parameters:
        type - effect type
        duration - measured in ticks, see getDuration()
        amplifier - the amplifier, see getAmplifier()
        ambient - the ambient status, see isAmbient()
        particles - the particle status, see hasParticles()
        icon - the icon status, see hasIcon()
      • PotionEffect

        public PotionEffect​(@NotNull
                            PotionEffectType type,
                            int duration,
                            int amplifier,
                            boolean ambient,
                            boolean particles)
        Creates a potion effect with no defined color.
        Parameters:
        type - effect type
        duration - measured in ticks, see getDuration()
        amplifier - the amplifier, see getAmplifier()
        ambient - the ambient status, see isAmbient()
        particles - the particle status, see hasParticles()
      • PotionEffect

        public PotionEffect​(@NotNull
                            PotionEffectType type,
                            int duration,
                            int amplifier,
                            boolean ambient)
        Creates a potion effect. Assumes that particles are visible
        Parameters:
        type - effect type
        duration - measured in ticks, see getDuration()
        amplifier - the amplifier, see getAmplifier()
        ambient - the ambient status, see isAmbient()
      • PotionEffect

        public PotionEffect​(@NotNull
                            Map<String,​Object> map)
        Constructor for deserialization.
        Parameters:
        map - the map to deserialize from
    • Method Detail

      • getAmplifier

        public int getAmplifier()
        Returns the amplifier of this effect. A higher amplifier means the potion effect happens more often over its duration and in some cases has more effect on its target.
        Returns:
        The effect amplifier
      • getDuration

        public int getDuration()
        Returns the duration (in ticks) that this effect will run for when applied to a LivingEntity.
        Returns:
        The duration of the effect
      • isAmbient

        public boolean isAmbient()
        Makes potion effect produce more, translucent, particles.
        Returns:
        if this effect is ambient
      • hasParticles

        public boolean hasParticles()
        Returns:
        whether this effect has particles or not
      • getColor

        @Deprecated
        @Nullable
        @Contract("-> null")
        public Color getColor()
        Deprecated.
        color is not part of potion effects
        Returns:
        color of this potion's particles. May be null if the potion has no particles or defined color.
      • hasIcon

        public boolean hasIcon()
        Returns:
        whether this effect has an icon or not
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object