# ConsumableComponentHelper

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

**Since:** 2.3.0

Reads how a stack is consumed. Nutrition and potion contents are separate components.  
```js
const use = Player.getPlayer()?.getMainHand().getComponents().getConsumable();  
if (use != null) Chat.log(`${use.getAnimation()} takes ${use.getDurationTicks()} ticks`);  
```

## Methods

### getAnimation {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumableComponentHelper_getAnimation-}

```js
getAnimation(): String
```

**Returns:** the animation name, such as `"eat"` or `"drink"`

### getDurationSeconds {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumableComponentHelper_getDurationSeconds-}

```js
getDurationSeconds(): float
```

**Returns:** the configured consumption time in seconds

### getDurationTicks {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumableComponentHelper_getDurationTicks-}

```js
getDurationTicks(): int
```

**Returns:** the consumption time Minecraft uses, in ticks

### getEffects {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumableComponentHelper_getEffects-}

```js
getEffects(): List<ConsumeEffectHelper>
```

Lists the effects configured in this component. Other components, such as potion contents,  
can provide additional effects.

**Returns:** the configured effects in Minecraft's application order

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

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

**Returns:** the ID of the configured consumption sound

### hasParticles {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ConsumableComponentHelper_hasParticles-}

```js
hasParticles(): boolean
```

**Returns:** whether consuming the item is configured to show particles
