Skip to content

PotionContentsHelper ​

com.jsmacrosce.jsmacros.client.api.helper.inventory.PotionContentsHelper

Since2.3.0

Reads the base potion, effects, and color stored on a potion or tipped arrow stack.

js
const contents = Player.getPlayer()?.getMainHand().getComponents().getPotionContents();  
if (contents != null) {
  for (const effect of contents.getEffects()) Chat.log(effect.getId());  
}

Methods ​

getColor ​

getColor(): int#
Returns the item's potion color, including a custom color when set.
Returns: the potion color as an RGB integer

getEffects ​

getEffects(): List<StatusEffectHelper>#
Returns copies of the base potion's effects followed by any custom effects. Durations are the values stored in the component, before any scaling from how the item is used.
Returns: the stored effects

getPotionId ​

getPotionId(): String#
Returns the base potion's ID. Custom effects can exist without a base potion.
Returns: the potion ID, "[unregistered]" for an inline value, or null if absent