# HungerChange

`com.jsmacrosce.jsmacros.client.api.event.impl.player.EventHungerChange`

**Since:** 1.2.7

**Cancellable:** No. Calling `event.cancel()` throws `UnsupportedOperationException`.

Fires before the local player's food level is assigned, when `setFoodLevel` receives a
value different from the current one. The event reports the incoming value.

## Constructors

### new EventHungerChange {#com.jsmacrosce.jsmacros.client.api.event.impl.player.EventHungerChange_constructor-int-}

```js
new EventHungerChange(int foodLevel)
```

Initializes this event with the supplied food-level value, stored unchanged in `foodLevel`.

**Parameters:**
- `foodLevel`: supplied food-level value

## Fields

### foodLevel {#com.jsmacrosce.jsmacros.client.api.event.impl.player.EventHungerChange_foodLevel}

```js
foodLevel: int
```

The incoming food-level value, conventionally 0 for an empty hunger bar through 20 for a full
one. This is the value passed to `setFoodLevel`; the method does not clamp it.

## Methods

### toString {#com.jsmacrosce.jsmacros.client.api.event.impl.player.EventHungerChange_toString-}

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

Returns an event-name-prefixed diagnostic string in the form `%s:{"foodLevel": %d}`.

**Returns:** diagnostic string containing the event name and stored food-level value
