# Spawners

> Reusable entity spawner handles with the Kore OOP module - register, spawn, and batch-summon entities.

Updated 2026-10-07. Canonical: https://kore.ayfri.com/docs/oop/spawners

Spawners wrap [entity summoning](https://minecraft.wiki/w/Commands/summon) into reusable, pre-configured handles.

They are useful whenever the same mob or entity should be spawned multiple times with the same base configuration.

> [!FOOTPRINT]
> Only the entities you spawn, plus one `spawner_<name>_spawn` function per spawner for your own commands: Kore never calls it, `spawn()` writes the `summon` inline. No objective, storage, forceloaded chunk, tick or load function.

## Registering a spawner

```kotlin
val zombieSpawner = registerSpawner("zombie", EntityTypes.ZOMBIE) {
	position = vec3(0, 64, 0)
}
```

Registering a spawner once helps keep coordinates, entity type, and spawn behavior in one predictable place.

## Using a spawner

```kotlin
function("spawn_wave") {
	with(zombieSpawner) {
		spawn()                     // summon at configured position
		spawnAt(vec3(10, 64, 10))   // summon at a specific position
		spawnMultiple(5)            // summon multiple at configured position
	}
}
```

| Function        | Description                         |
|-----------------|-------------------------------------|
| `spawn`         | Summon at the configured position   |
| `spawnAt`       | Summon at a specific position       |
| `spawnMultiple` | Summon N entities at configured pos |

## Example: spawning a wave

```kotlin
function("spawn_wave") {
	with(zombieSpawner) {
		spawnMultiple(5)
		spawnAt(vec3(12, 64, 12))
	}
}
```

This makes spawners a natural fit for waves, encounter scripts, arena refills, or scripted boss phases.

## See also

- [Entities & Players](https://kore.ayfri.com/docs/oop/entities-and-players.md) - Operate on the spawned entities afterwards with higher-level
  helpers.
- [Teams](https://kore.ayfri.com/docs/oop/teams.md) - Assign spawned waves to teams when organizing PvE or faction-based encounters.
- [Events](https://kore.ayfri.com/docs/oop/events.md) - React to deaths or interactions involving spawned entities.
