# ConsumeEffectHelper

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

**Since:** 2.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 {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumeEffectHelper_getAppliedEffects-}

```js
getAppliedEffects(): List<StatusEffectHelper>
```

**Returns:** copies of the status effects to apply, or `null` for other action types

### getApplyProbability {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumeEffectHelper_getApplyProbability-}

```js
getApplyProbability(): Float
```

**Returns:** the chance of applying the group of effects, from 0 to 1, or `null` for other action types

### getRemovedEffectIds {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumeEffectHelper_getRemovedEffectIds-}

```js
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 {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumeEffectHelper_getRemovedEffectTagId-}

```js
getRemovedEffectTagId(): String
```

**Returns:** the removal action's status effect tag ID without `"#"`, or `null` if no tag is used

### getSoundId {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumeEffectHelper_getSoundId-}

```js
getSoundId(): String
```

**Returns:** the sound played by this action, or `null` for other action types

### getTeleportDiameter {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumeEffectHelper_getTeleportDiameter-}

```js
getTeleportDiameter(): Float
```

**Returns:** the teleport area's configured diameter in blocks, or `null` for other action types

### getTypeId {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumeEffectHelper_getTypeId-}

```js
getTypeId(): String
```

**Returns:** the registered effect type ID, such as `"minecraft:apply_effects"`, or `null` if unregistered
