API reference / @jsprismarine/prismarine / world/RespawnPoint
world/RespawnPoint
Interfaces
RespawnTerrain
Defined in: packages/prismarine/src/world/RespawnPoint.ts:62
What resolving a spawn point needs to know about the world it names, read synchronously from the chunks the world has loaded.
Properties
maxY
readonlymaxY:number
Defined in: packages/prismarine/src/world/RespawnPoint.ts:64
minY
readonlyminY:number
Defined in: packages/prismarine/src/world/RespawnPoint.ts:63
Methods
getBlockName()
getBlockName(
x,y,z):string
Defined in: packages/prismarine/src/world/RespawnPoint.ts:68
The block's state name, such as minecraft:red_bed.
Parameters
x
number
y
number
z
number
Returns
string
isObstructed()
isObstructed(
x,y,z):boolean
Defined in: packages/prismarine/src/world/RespawnPoint.ts:66
Whether a player's body cannot occupy the block.
Parameters
x
number
y
number
z
number
Returns
boolean
StoredSpawnPoint
Defined in: packages/prismarine/src/world/RespawnPoint.ts:27
Where a player comes back, as the player record carries it.
Properties
dimension
readonlydimension:string
Defined in: packages/prismarine/src/world/RespawnPoint.ts:32
The dimension the block stands in, such as minecraft:overworld.
forced?
readonlyoptionalforced?:boolean
Defined in: packages/prismarine/src/world/RespawnPoint.ts:39
Whether the point is used whatever stands there.
True for /spawnpoint, which is Java's forced spawn, and false for a bed or a respawn anchor, which only holds a spawn while the block itself does.
x
readonlyx:number
Defined in: packages/prismarine/src/world/RespawnPoint.ts:28
y
readonlyy:number
Defined in: packages/prismarine/src/world/RespawnPoint.ts:29
z
readonlyz:number
Defined in: packages/prismarine/src/world/RespawnPoint.ts:30
Type Aliases
ResolvedSpawn
ResolvedSpawn = {
kind:"honored";position:Vector3; } | {kind:"destroyed"; }
Defined in: packages/prismarine/src/world/RespawnPoint.ts:72
What a stored spawn point resolved to.
Union Members
Type Literal
{ kind: "honored"; position: Vector3; }
The feet position the player comes back at.
Type Literal
{ kind: "destroyed"; }
The block that held the spawn is gone, or has nowhere free to stand.
RespawnBlockKind
RespawnBlockKind =
"bed"|"respawn_anchor"
Defined in: packages/prismarine/src/world/RespawnPoint.ts:94
The two kinds of block that hold a player's spawn point.
Functions
isRespawnBlock()
isRespawnBlock(
identifier):boolean
Defined in: packages/prismarine/src/world/RespawnPoint.ts:110
Whether a block holds a player's spawn point when they use it: see respawnBlockKind.
Parameters
identifier
string
Returns
boolean
resolveRespawn()
resolveRespawn(
spawn,terrain):ResolvedSpawn
Defined in: packages/prismarine/src/world/RespawnPoint.ts:173
Where a stored spawn point actually puts a player, or that it no longer does.
Parameters
spawn
The point the player record carries.
terrain
The world the point names, which the caller has already resolved.
Returns
respawnBlockExplodesIn()
respawnBlockExplodesIn(
identifier,attributes):boolean
Defined in: packages/prismarine/src/world/RespawnPoint.ts:150
Whether using a bed or a respawn anchor blows it up in a dimension: a bed whose rule there has destroy_on_use, as Java's BedBlock.useWithoutItem reads BedRule.explodes, and an anchor where respawn_anchor_works is off.
Parameters
identifier
string
The block clicked.
attributes
ReadonlyMap<string, unknown>
The dimension type's attributes.
Returns
boolean
Java See
AbstractBedBlock.useWithoutItem
respawnBlockKind()
respawnBlockKind(
identifier):RespawnBlockKind|undefined
Defined in: packages/prismarine/src/world/RespawnPoint.ts:102
Which kind of spawn-holding block an identifier names, or undefined for any other block.
The beds, whose identifiers are bed on Bedrock and <color>_bed on Java, and the respawn anchor. Charging the anchor is not modeled, so an anchor holds a spawn the way a bed does.
Parameters
identifier
string
Returns
RespawnBlockKind | undefined
respawnBlockWorksIn()
respawnBlockWorksIn(
identifier,attributes):boolean
Defined in: packages/prismarine/src/world/RespawnPoint.ts:130
Whether a bed or a respawn anchor sets a spawn in a dimension, by that dimension type's environment attributes.
Java reads minecraft:gameplay/bed_rule with can_set_spawn for a bed and minecraft:gameplay/respawn_anchor_works for an anchor. The 26.3 documents let a bed set a spawn in the Overworld only and an anchor work in the Nether only. A type that leaves the bed rule out gets Java's default, which allows it; one that leaves the anchor flag out gets Java's default, which does not. A block that is neither answers false.
Whether the block blows up instead is respawnBlockExplodesIn's answer.
Parameters
identifier
string
The block clicked, such as minecraft:red_bed.
attributes
ReadonlyMap<string, unknown>
The dimension type's attributes, as DimensionTypeDefinition carries them.
Returns
boolean
sameSpawnPoint()
sameSpawnPoint(
a,b):boolean
Defined in: packages/prismarine/src/world/RespawnPoint.ts:48
Whether two spawn points are the same point, set the same way.
Parameters
a
StoredSpawnPoint | undefined
One point, or undefined for none.
b
StoredSpawnPoint | undefined
The other.
Returns
boolean
True when both are absent, or both name the same block, dimension and kind.