> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nmentities.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Spawners

> Read and drive placed spawners from code: lookup, groups, live counts, enable, reset and trigger.

Spawners are declared in `Mobs/`: a spot in a world that keeps a population alive around itself. `NMEntitiesAPI.spawners()` exposes them to addons.

Every mutating call goes through the same path the `/nme spawner` commands do, so an addon and an admin have identical effects — including the on/off decision surviving a restart.

## Reading

```java theme={null}
SpawnersAPI spawners = NMEntitiesAPI.spawners();

spawners.ids();                        // every spawner id
spawners.get("crypt.entrance");        // the SpawnerDefinition, or null
spawners.all();
spawners.groups();                     // every group name in use
spawners.inGroup("crypt");             // the spawners in one group

spawners.liveCount("crypt.entrance");  // how many of its mobs are alive
spawners.isEnabled("crypt.entrance");
spawners.spawnerOf(entity);            // which spawner placed this, or null
```

## Driving

```java theme={null}
spawners.setEnabled("crypt", false);   // an id, a group, or "all" — remembered across restarts
spawners.trigger("crypt.entrance");    // one cycle now, ignoring warmup, cooldown and chance
spawners.reset("crypt", true);         // clear timers; true also removes its mobs
```

`setEnabled` accepts a single spawner id, a group name, or the literal `"all"` — the same targets the command takes.

## Levels

```java theme={null}
int level = NMEntitiesAPI.spawners().levelOf(entity);
```

`levelOf` reads the level a mob was spawned at, and returns `1` for anything a spawner didn't place.

<Note>
  Levels are recorded, but nothing scales stats by them yet. Read the value if your addon wants to do its own scaling.
</Note>
