Interface PotionEffect.Builder

All Superinterfaces:
AbstractBuilder<PotionEffect>, Builder<PotionEffect,PotionEffect.Builder>, CopyableBuilder<PotionEffect,PotionEffect.Builder>, DataBuilder<PotionEffect>, ResettableBuilder<PotionEffect,PotionEffect.Builder>
Enclosing interface:
PotionEffect

Represents a builder interface to create a PotionEffect.
  • Method Details

    • potionType

      PotionEffect.Builder potionType(PotionEffectType potionEffectType)
      Sets the PotionEffectType of the potion.
      Parameters:
      potionEffectType - The type of item
      Returns:
      This builder, for chaining
    • potionType

      default PotionEffect.Builder potionType(Supplier<? extends PotionEffectType> potionEffectType)
      Sets the PotionEffectType of the potion.
      Parameters:
      potionEffectType - The type of item
      Returns:
      This builder, for chaining
    • duration

      Sets the duration in ticks of the potion effect.

      The duration must be greater than zero ticks.

      Parameters:
      duration - The duration in ticks of this effect
      Returns:
      This builder, for chaining
      Throws:
      IllegalArgumentException - If the duration is less than or equal to zero
    • amplifier

      PotionEffect.Builder amplifier(int amplifier)
      Sets the amplifier power of the potion effect.

      See PotionEffect.amplifier() for an explanation of what the amplifier means.

      Parameters:
      amplifier - The amplifier power
      Returns:
      This builder, for chaining
    • ambient

      PotionEffect.Builder ambient(boolean ambient)
      Sets whether the potion effect is ambient. Ambient potions emit more translucent particles.
      Parameters:
      ambient - Whether the potion effect is ambient
      Returns:
      This builder, for chaining
    • showParticles

      PotionEffect.Builder showParticles(boolean showParticles)
      Sets whether the potion effect should show particles when applied.
      Parameters:
      showParticles - Whether the potion effect will show particles
      Returns:
      This builder, for chaining
    • showIcon

      PotionEffect.Builder showIcon(boolean showIcon)
      Sets whether the potion effect should show its icon when applied.
      Parameters:
      showIcon - Whether the potion effect will show its icon
      Returns:
      This builder, for chaining
    • build

      Builds an instance of a PotionEffect.
      Specified by:
      build in interface AbstractBuilder<PotionEffect>
      Returns:
      A new instance of a PotionEffect
      Throws:
      IllegalStateException - If the potion effect is not completed