# VillagerEntityHelper

`com.jsmacrosce.jsmacros.client.api.helper.world.entity.VillagerEntityHelper`

**Since:** 1.6.3

A villager helper exposing the villager's profession, type, level and experience.  
 
 The trade list is not available from the entity on the client; see
 [MerchantEntityHelper.getTrades()](MerchantEntityHelper.md#com.jsmacrosce.jsmacros.client.api.helper.world.entity.MerchantEntityHelper_getTrades-) for the client-side source of displayed offers.  
 ```js
const villagers = World.getEntities("villager");  
if (villagers !== null) {
  for (const entity of villagers) {
    if (!(entity instanceof EntityHelpers.Villager)) continue;  
    Chat.log(`a level ${entity.getLevel()} ${entity.getProfession()} `
      + `holding ${entity.getExperience()} xp`);  
  }
}
 ```

Available in scripts as `EntityHelpers.Villager`.

## Constructors

### new VillagerEntityHelper {#com.jsmacrosce.jsmacros.client.api.helper.world.entity.VillagerEntityHelper_constructor-Villager-}

```js
new VillagerEntityHelper(Villager e)
```

Wraps the supplied villager, retaining the same reference.

**Parameters:**
- `e`: villager to wrap

## Methods

### getLevel {#com.jsmacrosce.jsmacros.client.api.helper.world.entity.VillagerEntityHelper_getLevel-}

```js
getLevel(): int
```

Returns the villager's trading level, clamped by the game to a minimum of one
 and with five as the maximum. This is distinct from accumulated trading
 experience, returned by [getExperience()](MerchantEntityHelper.md#com.jsmacrosce.jsmacros.client.api.helper.world.entity.MerchantEntityHelper_getExperience-).

**Returns:** this villager's trading level, from one to five

**Since:** 1.6.3

### getProfession {#com.jsmacrosce.jsmacros.client.api.helper.world.entity.VillagerEntityHelper_getProfession-}

```js
getProfession(): String
```

Returns the profession's registered name, including its namespace, rather than
 its translated display name. A villager without a job has the `nitwit`
 profession.

**Returns:** the registry id of this villager's profession

**Since:** 1.6.3

### getStyle {#com.jsmacrosce.jsmacros.client.api.helper.world.entity.VillagerEntityHelper_getStyle-}

```js
getStyle(): String
```

Returns the villager's biome type, which determines its appearance rather than
 its profession. This is the holder's `toString()` representation, not a
 stable registry id; use the biome at the villager's position to identify where it
 currently stands.

**Returns:** the holder's own string form for this villager's biome type

**Since:** 1.6.3
