[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/prismarine](https://jsprismarine.dev/api/@jsprismarine/prismarine/index.md) / world/RespawnSearch

# world/RespawnSearch

## Classes

- [RespawnSearch](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/RespawnSearch/classes/RespawnSearch.md)

## Interfaces

### RespawnAnswer

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:42](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L42)

Where the search says the player comes back.

#### Properties

##### announced

> `readonly` **announced**: [`RespawnPosition`](#respawnposition)

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:53](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L53)

The three positions the respawn exchange sends; see `respawnPoint`.

##### block

> `readonly` **block**: [`RespawnPosition`](#respawnposition)

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:54](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L54)

##### dimension

> `readonly` **dimension**: `string`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:51](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L51)

The id of the dimension the position is in, such as `minecraft:the_nether`.

##### eyes

> `readonly` **eyes**: [`RespawnPosition`](#respawnposition)

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:55](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L55)

##### player

> `readonly` **player**: `string`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:44](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L44)

The key the request named.

##### spawn

> `readonly` **spawn**: `"world"` \| `"own"`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:49](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L49)

Which spawn it is: `own` is the player's spawn point, in its dimension of the level the
search belongs to, and `world` is the world spawn, in the default level's Overworld.

##### spawnPoint

> `readonly` **spawnPoint**: [`StoredSpawnPoint`](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/RespawnPoint/index.md#storedspawnpoint) \| `undefined`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:66](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L66)

The spawn point the search examined, the request's. A player who set another one while
the search waited keeps it.

##### spawnPointLost

> `readonly` **spawnPointLost**: `boolean`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:61](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L61)

Whether the player's own spawn point stopped holding: the bed or anchor is gone or has
nowhere free beside it, or names a dimension the level has no stem for. The player clears
it and is told, so the next death goes straight to the world spawn.

***

### RespawnPosition

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:25](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L25)

A position as plain numbers.

#### Properties

##### x

> `readonly` **x**: `number`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:26](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L26)

##### y

> `readonly` **y**: `number`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:27](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L27)

##### z

> `readonly` **z**: `number`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:28](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L28)

***

### RespawnRequest

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:32](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L32)

What a respawn search is asked.

#### Properties

##### body

> `readonly` **body**: [`BodyBox`](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/SpawnPlacement/index.md#bodybox) & `object`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:38](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L38)

The player's body: the box that has to fit at the world spawn, and the eye height above the feet.

###### Type Declaration

###### eyeHeight

> `readonly` **eyeHeight**: `number`

##### player

> `readonly` **player**: `string`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:34](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L34)

The player's key; see `keyOfPlayer`. The answer carries it back.

##### spawnPoint

> `readonly` **spawnPoint**: [`StoredSpawnPoint`](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/RespawnPoint/index.md#storedspawnpoint) \| `undefined`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:36](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L36)

The player's own spawn point, from a bed, an anchor or `/spawnpoint`, or undefined for none.

***

### RespawnWorlds

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:70](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L70)

The worlds a search reads.

#### Methods

##### built()

> **built**(`stemId`): [`World`](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/World/classes/World.md) \| `undefined`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:76](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L76)

The level's world of a stem if it is built and enabled, without building it.

###### Parameters

###### stemId

`string`

###### Returns

[`World`](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/World/classes/World.md) \| `undefined`

##### hasStem()

> **hasStem**(`stemId`): `boolean`

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:72](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L72)

Whether the level the search belongs to has a stem of that id.

###### Parameters

###### stemId

`string`

###### Returns

`boolean`

##### world()

> **world**(`stemId`): `Promise`\<[`World`](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/World/classes/World.md)\>

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:74](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L74)

The level's world of a stem, built and enabled when nobody has been there since the save opened.

###### Parameters

###### stemId

`string`

###### Returns

`Promise`\<[`World`](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/World/classes/World.md)\>

##### worldSpawn()

> **worldSpawn**(): [`World`](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/World/classes/World.md)

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:78](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L78)

The world the world spawn is in: the default level's Overworld.

###### Returns

[`World`](https://jsprismarine.dev/api/@jsprismarine/prismarine/world/World/classes/World.md)

## Type Aliases

### RespawnAttempt

> **RespawnAttempt** = \{ `answer`: [`RespawnAnswer`](#respawnanswer); `kind`: `"answer"`; \} \| \{ `failed?`: readonly `unknown`[]; `kind`: `"waiting"`; \}

Defined in: [packages/prismarine/src/world/RespawnSearch.ts:136](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/world/RespawnSearch.ts#L136)

What an attempt says: the answer, or that it waits for something it has asked for. A waiting
attempt carries what went wrong with work an earlier attempt started for it, which this one
started again, for the caller to report.
