# FoodComponentHelper

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

**Since:** 1.8.4

Exposes an item's nutrition, saturation, and always-edible flag.  
 ```js
const apple = Client.getRegistryManager().getItem("minecraft:golden_apple");  
const food = apple.getFood();  
if (food !== null) {
  Chat.log(`${food.getHunger()} hunger points, ${food.getSaturation()} saturation`);  
}
 ```

## Constructors

### new FoodComponentHelper {#com.jsmacrosce.jsmacros.client.api.helper.inventory.FoodComponentHelper_constructor-FoodProperties-}

```js
new FoodComponentHelper(FoodProperties base)
```

Wraps the supplied food properties for access through this helper.

**Parameters:**
- `base`: raw food properties to wrap

## Methods

### getHunger {#com.jsmacrosce.jsmacros.client.api.helper.inventory.FoodComponentHelper_getHunger-}

```js
getHunger(): int
```

Returns this food's nutrition value in hunger points (two points per bar segment).

**Returns:** the amount of hunger this food restores.

**Since:** 1.8.4

### getSaturation {#com.jsmacrosce.jsmacros.client.api.helper.inventory.FoodComponentHelper_getSaturation-}

```js
getSaturation(): float
```

Returns the saturation value stored for this food.

**Returns:** the amount of saturation this food restores.

**Since:** 1.8.4

### isAlwaysEdible {#com.jsmacrosce.jsmacros.client.api.helper.inventory.FoodComponentHelper_isAlwaysEdible-}

```js
isAlwaysEdible(): boolean
```

Returns whether this food's always-edible flag is set.

**Returns:** `true` if the always-edible flag is set; `false` otherwise.

**Since:** 1.8.4

### toString {#com.jsmacrosce.jsmacros.client.api.helper.inventory.FoodComponentHelper_toString-}

```js
toString(): String
```

Returns a diagnostic representation of this food's nutrition, saturation, and always-edible flag.

**Returns:** diagnostic representation of the food properties
