Skip to content

ConsumeEffectHelper ​

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

Since2.3.0

Describes an action configured to run when an item is consumed, such as applying status effects.

js
const use = Player.getPlayer()?.getMainHand().getComponents().getConsumable();  
if (use != null) {
  for (const effect of use.getEffects()) {
    const chance = effect.getApplyProbability();  
    if (chance !== null) Chat.log(`${effect.getTypeId()}: ${Math.round(chance * 100)}% chance`);  
  }
}

Methods ​

getAppliedEffects ​

getAppliedEffects(): List<StatusEffectHelper>#
Returns: copies of the status effects to apply, or null for other action types

getApplyProbability ​

getApplyProbability(): Float#
Returns: the chance of applying the group of effects, from 0 to 1, or null for other action types

getRemovedEffectIds ​

getRemovedEffectIds(): List<String>#
Lists the status effects selected by a removal action. Tags whose members are not loaded have an empty list. An action that clears all effects is identified by its type ID instead.
Returns: the selected status effect IDs, or null for other action types

getRemovedEffectTagId ​

getRemovedEffectTagId(): String#
Returns: the removal action's status effect tag ID without "#", or null if no tag is used

getSoundId ​

getSoundId(): String#
Returns: the sound played by this action, or null for other action types

getTeleportDiameter ​

getTeleportDiameter(): Float#
Returns: the teleport area's configured diameter in blocks, or null for other action types

getTypeId ​

getTypeId(): String#
Returns: the registered effect type ID, such as "minecraft:apply_effects", or null if unregistered