Skip to content

API reference / @jsprismarine/prismarine / entity/storePlayer / StorePlayer

Class: StorePlayer ​

Defined in: packages/prismarine/src/entity/storePlayer.ts:94

A store player, with its entity while one is in a store.

Implements ​

Constructors ​

Constructor ​

new StorePlayer(id, identity): StorePlayer

Defined in: packages/prismarine/src/entity/storePlayer.ts:151

Parameters ​

id ​

number

The entity id drawn at the login, which every entity of this player is given.

identity ​

StorePlayerIdentity

Who the player is.

Returns ​

StorePlayer

Properties ​

attributes ​

readonly attributes: Attributes

Defined in: packages/prismarine/src/entity/storePlayer.ts:99

The client's attribute table. While the player is in a store its health entry is not read, because health is the entity's; while it is in none, the entry holds it.

Implementation of ​

PlayerRecordTarget.attributes


device ​

device: Device | null = null

Defined in: packages/prismarine/src/entity/storePlayer.ts:109

The device the login named, or null when it said nothing.


id ​

readonly id: number

Defined in: packages/prismarine/src/entity/storePlayer.ts:152

The entity id drawn at the login, which every entity of this player is given.


javaSkinParts ​

javaSkinParts: number | undefined = undefined

Defined in: packages/prismarine/src/entity/storePlayer.ts:105

The parts of its skin a Java player shows, from its client's settings.


javaTextures ​

javaTextures: { signature: string | null; value: string; } | undefined = undefined

Defined in: packages/prismarine/src/entity/storePlayer.ts:103

A Java player's signed textures property, which Java clients draw the skin from.


locale ​

locale: string = 'en_US'

Defined in: packages/prismarine/src/entity/storePlayer.ts:112

The language the login named, such as en_US, which a script reads as the client's locale.


metadata ​

readonly metadata: Metadata

Defined in: packages/prismarine/src/entity/storePlayer.ts:120

The actor metadata the components keep air, breathing and sprinting in, and which the player's own client is shown while the player is in no store. In a store, clients are shown the actor's metadata, which reads these from the components.


platformChatId ​

platformChatId: string = ''

Defined in: packages/prismarine/src/entity/storePlayer.ts:114

The platform chat id, which the login handler does not read yet and leaves empty.


skin ​

skin: Skin | null = null

Defined in: packages/prismarine/src/entity/storePlayer.ts:101

The skin the login carried, which a skin change replaces.

Accessors ​

entity ​

Get Signature ​

get entity(): DataEntity | undefined

Defined in: packages/prismarine/src/entity/storePlayer.ts:178

The minecraft:player entity while the player is in a store, or undefined while it is in none.

Returns ​

DataEntity | undefined


gamemode ​

Get Signature ​

get gamemode(): Gametype

Defined in: packages/prismarine/src/entity/storePlayer.ts:283

The game mode, a logged component field the survival systems read.

Returns ​

Gametype

Set Signature ​

set gamemode(gamemode): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:287

Parameters ​
gamemode ​

Gametype

Returns ​

void

Implementation of ​

PlayerRecordTarget.gamemode


headYaw ​

Get Signature ​

get headYaw(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:167

Where the head looks, which the client reports apart from the body's yaw. Logged while in a store.

Returns ​

number

Set Signature ​

set headYaw(headYaw): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:171

Parameters ​
headYaw ​

number

Returns ​

void

Implementation of ​

PlayerRecordSource.headYaw


heldEntity ​

Get Signature ​

get heldEntity(): HeldEntity

Defined in: packages/prismarine/src/entity/storePlayer.ts:183

What the player keeps of its entity while it is in no store, which its next entry starts from.

Returns ​

HeldEntity


persistentNbt ​

Get Signature ​

get persistentNbt(): NBTTagCompound | null

Defined in: packages/prismarine/src/entity/storePlayer.ts:400

The actor record tags this server does not model, which a script's dynamic properties live in: the entity's while the player is in a store, and what the player holds for the next store otherwise. A new compound on every read; change one by assigning it back.

Returns ​

NBTTagCompound | null

Set Signature ​

set persistentNbt(tags): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:405

The actor record tags this server does not model, which a script's dynamic properties live in, or null when the player has none.

Parameters ​
tags ​

NBTTagCompound | null

Returns ​

void

The actor record tags this server does not model, which a script's dynamic properties live in, or null when the player has none.

Implementation of ​

PlayerRecordTarget.persistentNbt


pitch ​

Get Signature ​

get pitch(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:322

Returns ​

number

Implementation of ​

PlayerRecordSource.pitch


yaw ​

Get Signature ​

get yaw(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:326

Returns ​

number

Implementation of ​

PlayerRecordSource.yaw

Methods ​

addFood() ​

addFood(food, saturation?): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:542

Feeds the player, as eating does.

Parameters ​

food ​

number

saturation? ​

number = 0

Returns ​

void


attach() ​

attach(entity, systems?): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:196

Takes an entity that is entering a store as this player's, before it enters: the position, the look, the health, the tags and the status effects the player held are written onto it, and from now on the player's writes are logged there and the store's systems run it.

Parameters ​

entity ​

DataEntity

The entity, built with this player's id and not yet entered.

systems? ​

Pick<PlayerSystems, "attach">

The player systems of the entity's runtime; left out, nothing is logged.

Returns ​

void

Throws ​

When the entity has another id, or the player already has an entity.


beginItemUse() ​

beginItemUse(tick): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:474

Notes that the player started holding an item down. Bedrock says only "started" and later "released", so the charge of a bow is the time between them, measured here.

Parameters ​

tick ​

number

The server tick it began on.

Returns ​

void


claimUpdate() ​

claimUpdate(tick): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:592

Claims the player's one actor update of a server tick. The player keeps the claim rather than its actor, because a dimension change mid-tick gives it a new actor in a world the level ticks later, which would otherwise update it a second time.

Parameters ​

tick ​

number

Returns ​

boolean

Whether this is the first claim of tick.


detach() ​

detach(record): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:233

Lets go of the entity before it leaves its store, keeping what the next store needs: the position, the look, the health, and the entity's record, tags and status effects.

Parameters ​

record ​

DataEntityRecord

The entity's record as it is now, which the next store restores.

Returns ​

boolean

Whether the player had an entity.


getComponents() ​

getComponents(): PlayerComponents

Defined in: packages/prismarine/src/entity/storePlayer.ts:391

The player's logged component state, which the survival rules write through.

Returns ​

PlayerComponents


getCraftingInput() ​

getCraftingInput(): CraftingInput

Defined in: packages/prismarine/src/entity/storePlayer.ts:381

What is sitting in the crafting slots, whether the inventory's four or a table's nine.

Returns ​

CraftingInput


getEquipment() ​

getEquipment(): ViewableEquipment

Defined in: packages/prismarine/src/entity/storePlayer.ts:386

What the player wears and holds.

Returns ​

ViewableEquipment


getExperience() ​

getExperience(): ExperienceHolder

Defined in: packages/prismarine/src/entity/storePlayer.ts:454

The experience, as the level and the bar the client is sent, written through logged setters.

Returns ​

ExperienceHolder


getFallDistance() ​

getFallDistance(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:449

How far the player has fallen since it was last supported. A blow struck while this is above zero is a critical: a player rising through a jump is not falling.

Returns ​

number


getFeetY() ​

getFeetY(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:347

The bottom of the player's body, the eye height below what it reports.

Returns ​

number


getFood() ​

getFood(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:522

Food, out of 20.

Returns ​

number

Implementation of ​

PlayerRecordSource.getFood


getHealth() ​

getHealth(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:490

The health, the entity's while the player is in a store.

Returns ​

number

Implementation of ​

PlayerRecordTarget.getHealth


getInventory() ​

getInventory(): HumanInventory

Defined in: packages/prismarine/src/entity/storePlayer.ts:376

Everything the player carries.

Returns ​

HumanInventory

Implementation of ​

PlayerRecordTarget.getInventory


getMaxHealth() ​

getMaxHealth(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:496

The most health the player can have, which the entity's type decides while it is in a store.

Returns ​

number

Implementation of ​

PlayerRecordSource.getMaxHealth


getName() ​

getName(): string

Defined in: packages/prismarine/src/entity/storePlayer.ts:297

The display name.

Returns ​

string

Implementation of ​

PlayerRecordSource.getName


getPortalCooldown() ​

getPortalCooldown(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:599

Ticks left before the player may enter a portal again.

Returns ​

number

Implementation of ​

PlayerRecordSource.getPortalCooldown


getPosition() ​

getPosition(): Vector3

Defined in: packages/prismarine/src/entity/storePlayer.ts:312

The eye, EYE_HEIGHT above the feet, which is what a player reports.

Returns ​

Vector3

Implementation of ​

PlayerRecordSource.getPosition


getRuntimeId() ​

getRuntimeId(): bigint

Defined in: packages/prismarine/src/entity/storePlayer.ts:273

The entity id as the wire carries it, which every entity query knows the player by.

Returns ​

bigint


getSaturation() ​

getSaturation(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:532

The hidden buffer spent before food.

Returns ​

number

Implementation of ​

PlayerRecordSource.getSaturation


getSpawnPoint() ​

getSpawnPoint(): StoredSpawnPoint | undefined

Defined in: packages/prismarine/src/entity/storePlayer.ts:547

The player's own spawn point, or undefined for the world spawn.

Returns ​

StoredSpawnPoint | undefined

Implementation of ​

PlayerRecordSource.getSpawnPoint


getStatusEffects() ​

getStatusEffects(): readonly StatusEffect[]

Defined in: packages/prismarine/src/entity/storePlayer.ts:421

The status effects on the player, the entity's while it is in a store.

Returns ​

readonly StatusEffect[]


getSubject() ​

getSubject(): Subject

Defined in: packages/prismarine/src/entity/storePlayer.ts:307

Who the player is to the permission files.

Returns ​

Subject


getTags() ​

getTags(): readonly string[]

Defined in: packages/prismarine/src/entity/storePlayer.ts:416

The /tag tags the player carries, the entity's while it is in a store.

Returns ​

readonly string[]


getTimeSinceRest() ​

getTimeSinceRest(): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:576

Ticks since the player last slept or died, Java's Stats.TIME_SINCE_REST, which decides whether phantoms come for them. A statistic, as in Java, kept beside the player's logged components rather than in them, so a tick spent awake writes nothing to the change log.

Returns ​

number

Java Source ​

Stats.TIME_SINCE_REST

Implementation of ​

PlayerRecordSource.getTimeSinceRest


getType() ​

getType(): string

Defined in: packages/prismarine/src/entity/storePlayer.ts:278

The type of the player's entity, minecraft:player.

Returns ​

string


getUUID() ​

getUUID(): UUIDValue

Defined in: packages/prismarine/src/entity/storePlayer.ts:292

The protocol identity the login carried.

Returns ​

UUIDValue

Implementation of ​

PlayerRecordSource.getUUID


getVelocity() ​

getVelocity(): object

Defined in: packages/prismarine/src/entity/storePlayer.ts:318

How fast the player moves, in blocks a tick; at rest while the player is in no store.

Returns ​

object

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: number


getXUID() ​

getXUID(): string | null

Defined in: packages/prismarine/src/entity/storePlayer.ts:302

The XUID, or null when the login carried none, as keyOfPlayer reads it.

Returns ​

string | null


hasSeenCredits() ​

hasSeenCredits(): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:560

Whether the player has watched the end credits.

Returns ​

boolean

Implementation of ​

PlayerRecordSource.hasSeenCredits


isFlying() ​

isFlying(): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:512

Whether the player is flying.

Returns ​

boolean

Implementation of ​

PlayerRecordSource.isFlying


isGliding() ​

isGliding(): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:431

Whether the player is gliding on an elytra, which the server allowed and has not ended.

Returns ​

boolean


isOnGround() ​

isOnGround(): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:361

Whether the client last reported the player on the ground: the body's on_ground condition, false while the player is in no store.

Returns ​

boolean


isSleeping() ​

isSleeping(): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:441

Whether the player lies in a bed, which its entity keeps as the bed it sleeps in.

Returns ​

boolean


isSneaking() ​

isSneaking(): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:436

Whether the client last reported the player sneaking.

Returns ​

boolean


isSprinting() ​

isSprinting(): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:426

Whether the client last reported the player sprinting.

Returns ​

boolean


placeAt() ​

placeAt(recorded): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:334

Puts the player where a record says its eyes were.

Parameters ​

recorded ​

RecordedPosition

The eye position and the look.

Returns ​

void


release() ​

release(entity): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:261

Lets go of an entity whose entry into its store was undone, which leaves the player as it was before StorePlayer.attach: in no store, holding what it held then. Unlike StorePlayer.detach, it keeps no record, so the next entry starts the way this one did.

Parameters ​

entity ​

DataEntity

The entity the undone entry added, which the undo has taken out again.

Returns ​

boolean

Whether it was the player's entity.


restoreFlying() ​

restoreFlying(flying): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:517

Writes the flying flag; nothing is sent.

Parameters ​

flying ​

boolean

Returns ​

void

Implementation of ​

PlayerRecordTarget.restoreFlying


restoreHealth() ​

restoreHealth(health): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:502

Writes the health, held to its maximum.

Parameters ​

health ​

number

Returns ​

void

Implementation of ​

PlayerRecordTarget.restoreHealth


setAttributeValue() ​

setAttributeValue(name, value): boolean

Defined in: packages/prismarine/src/entity/storePlayer.ts:463

Sets an attribute, through the component field it is kept in when it has one, so the write is logged.

Parameters ​

name ​

string

value ​

number

Returns ​

boolean

Whether the value changed.


setFood() ​

setFood(food): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:527

Writes food, held inside the attribute's bounds.

Parameters ​

food ​

number

Returns ​

void

Implementation of ​

PlayerRecordTarget.setFood


setPortalCooldown() ​

setPortalCooldown(ticks): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:604

Starts the portal cooldown, in whole ticks and never below zero, as a live player's.

Parameters ​

ticks ​

number

Returns ​

void

Implementation of ​

PlayerRecordTarget.setPortalCooldown


setSaturation() ​

setSaturation(saturation): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:537

Writes saturation, which never exceeds food, as a live player's does.

Parameters ​

saturation ​

number

Returns ​

void

Implementation of ​

PlayerRecordTarget.setSaturation


setSeenCredits() ​

setSeenCredits(seen): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:565

Records whether the player has watched the end credits.

Parameters ​

seen ​

boolean

Returns ​

void

Implementation of ​

PlayerRecordTarget.setSeenCredits


setSpawnPoint() ​

setSpawnPoint(spawn): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:555

Moves the player's own spawn point, or clears it back to the world spawn. A frozen copy is stored, so the caller's object cannot move the point later without a logged write.

Parameters ​

spawn ​

StoredSpawnPoint | undefined

Returns ​

void

Implementation of ​

PlayerRecordTarget.setSpawnPoint


setTimeSinceRest() ​

setTimeSinceRest(ticks): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:581

Sets the ticks since the player last slept or died, as the rest clock and a saved record do.

Parameters ​

ticks ​

number

Returns ​

void

Implementation of ​

PlayerRecordTarget.setTimeSinceRest


standAt() ​

standAt(feet): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:352

Puts the player's feet at a position, keeping the look.

Parameters ​

feet ​

EntityPosition

Returns ​

void


takeItemUseTicks() ​

takeItemUseTicks(tick): number

Defined in: packages/prismarine/src/entity/storePlayer.ts:483

How long the current use has lasted, in ticks, and forgets it.

Parameters ​

tick ​

number

The server tick it ended on.

Returns ​

number

Ticks held, or zero if nothing was being held.


watchSlots() ​

watchSlots(watcher): void

Defined in: packages/prismarine/src/entity/storePlayer.ts:371

Hears every later write to a slot of the player's inventory, whether or not the player is in a store, with the slot's logged value before and after it. The session joined to this player watches it for the advancement trigger a slot change raises.

Parameters ​

watcher ​

SlotWatcher

Hears each write. It replaces any watcher set before.

Returns ​

void