Interface ThrownPotion

All Superinterfaces:
Audience, CommandSender, DataComponentView, Entity, HoverEventSource<HoverEvent.ShowEntity>, Metadatable, Nameable, Permissible, PersistentDataHolder, PersistentDataViewHolder, Pointered, Projectile, ServerOperator, Sound.Emitter, ThrowableProjectile
All Known Subinterfaces:
LingeringPotion, SplashPotion

@NullMarked public interface ThrownPotion extends ThrowableProjectile
Represents a thrown potion bottle
  • Method Details

    • getEffects

      Collection<PotionEffect> getEffects()
      Returns the effects that are applied by this potion.
      Returns:
      The potion effects
    • getItem

      ItemStack getItem()
      Returns a copy of the ItemStack for this thrown potion.

      Altering this copy will not alter the thrown potion directly. If you want to alter the thrown potion, you must use the setItemStack method.

      Specified by:
      getItem in interface ThrowableProjectile
      Returns:
      A copy of the ItemStack for this thrown potion.
    • setItem

      void setItem(ItemStack item)
      Set the ItemStack for this thrown potion.
      Specified by:
      setItem in interface ThrowableProjectile
      Parameters:
      item - New ItemStack
    • getPotionMeta

      @Obsolete PotionMeta getPotionMeta()
      Gets a copy of the PotionMeta for this thrown potion. This includes what effects will be applied by this potion.
      Returns:
      potion meta
      API Note:
      obsolete in favor of getItem() / setItem(ItemStack) with the equivalent DataComponentTypes.POTION_CONTENTS component
    • setPotionMeta

      @Obsolete void setPotionMeta(PotionMeta meta)
      Sets the PotionMeta of this thrown potion. This will modify the effects applied by this potion.

      Note that the type of getItem() is irrelevant

      Parameters:
      meta - potion meta
      API Note:
      obsolete in favor of getItem() / setItem(ItemStack) with the equivalent DataComponentTypes.POTION_CONTENTS component
    • splash

      void splash()
      Splashes the potion at its current location.