Interface ConsumeEffect

All Known Subinterfaces:
ConsumeEffect.ApplyStatusEffects, ConsumeEffect.ClearAllStatusEffects, ConsumeEffect.PlaySound, ConsumeEffect.RemoveStatusEffects, ConsumeEffect.TeleportRandomly

@NullMarked @Experimental @NonExtendable public interface ConsumeEffect
Effect that occurs when consuming an item.
  • Method Details

    • teleportRandomlyEffect

      @Contract(value="_ -> new", pure=true) static ConsumeEffect.TeleportRandomly teleportRandomlyEffect(float diameter)
      Creates a consume effect that randomly teleports the entity on consumption.
      Parameters:
      diameter - diameter of random teleportation
      Returns:
      the effect instance
    • removeEffects

      @Contract(value="_ -> new", pure=true) static ConsumeEffect.RemoveStatusEffects removeEffects(RegistryKeySet<PotionEffectType> effects)
      Creates a consume effect that removes status effects on consumption.
      Parameters:
      effects - the potion effects to remove
      Returns:
      the effect instance
    • playSoundConsumeEffect

      @Contract(value="_ -> new", pure=true) static ConsumeEffect.PlaySound playSoundConsumeEffect(Key key)
      Creates a consume effect that plays a sound on consumption.
      Parameters:
      key - the key sound effect to play
      Returns:
      the effect instance
    • clearAllStatusEffects

      @Contract(value="-> new", pure=true) static ConsumeEffect.ClearAllStatusEffects clearAllStatusEffects()
      Creates a consume effect that clears all status effects.
      Returns:
      the effect instance
    • applyStatusEffects

      @Contract(value="_, _ -> new", pure=true) static ConsumeEffect.ApplyStatusEffects applyStatusEffects(List<PotionEffect> effects, float probability)
      Creates a consume effect that gives potion effects on consumption.
      Parameters:
      effects - the potion effects to apply
      probability - the probability of these effects being applied, between 0 and 1 inclusive
      Returns:
      the effect instance