Skip to content

API reference / @jsprismarine/prismarine / entity/data/storePlayers / StorePlayerActor

Class: StorePlayerActor ​

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:207

One store player as the network layer and the world code read it.

The position, the look and the status effects come from the store, as a mob's do, and the identity, the head yaw, the game mode, flight and equipment from the StorePlayer. Where a player and a mob differ in how they are shown, this follows what a client expects of a player.

Extends ​

Implements ​

Constructors ​

Constructor ​

new StorePlayerActor(player, entity, world, blows): StorePlayerActor

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:222

Parameters ​

player ​

StorePlayer

The store player behind the actor.

entity ​

DataEntity

The player's entity in this actor's store.

world ​

World

blows ​

StoreActorBlows

Returns ​

StorePlayerActor

Overrides ​

StoreActor.constructor

Properties ​

entity ​

readonly entity: DataEntity

Defined in: packages/prismarine/src/entity/data/storeActors.ts:103

The store entity behind the actor.

Inherited from ​

StoreActor.entity


player ​

readonly player: StorePlayer

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:223

The store player behind the actor.

Accessors ​

attributes ​

Get Signature ​

get attributes(): Attributes

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:212

None: other clients were never sent a legacy player's attributes, and its own client is sent them by its session.

Returns ​

Attributes

The attributes a client is sent.

Implementation of ​

ShownPlayer.attributes

Overrides ​

StoreActor.attributes


device ​

Get Signature ​

get device(): Device | null

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:340

The device the client logged in from, or null when it said nothing.

Returns ​

Device | null

The device the client logged in from, or null when it said nothing.

Implementation of ​

ShownPlayer.device


gamemode ​

Get Signature ​

get gamemode(): Gametype

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:348

Returns ​

Gametype

Implementation of ​

ShownPlayer.gamemode


headYaw ​

Get Signature ​

get headYaw(): number

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:313

The head turns apart from the body, as the client reports it.

Returns ​

number

Implementation of ​

ShownPlayer.headYaw

Overrides ​

StoreActor.headYaw


metadata ​

Get Signature ​

get metadata(): Metadata

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:237

The projection of the entity's components, then what the player's components decide about its metadata, which the projection knows nothing of: air and breathing, which the breath system keeps, sprinting, gliding, and whether it may fly, which its game mode decides, as a legacy player writes them into its own metadata.

Returns ​

Metadata

The actor metadata a client is sent, flags and properties both.

Implementation of ​

ShownPlayer.metadata

Overrides ​

StoreActor.metadata


persistentNbt ​

Get Signature ​

get persistentNbt(): NBTTagCompound | null

Defined in: packages/prismarine/src/entity/data/storeActors.ts:141

The actor record tags this server does not model, which the next save writes back, such as the actor's UniqueID. A save writes the entity's record into them first.

They are kept in the store, as network NBT bytes in a logged field, so this answers 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/data/storeActors.ts:146

Parameters ​
tags ​

NBTTagCompound | null

Returns ​

void

Inherited from ​

StoreActor.persistentNbt


pitch ​

Get Signature ​

get pitch(): number

Defined in: packages/prismarine/src/entity/data/storeActors.ts:186

Returns ​

number

Implementation of ​

ShownPlayer.pitch

Inherited from ​

StoreActor.pitch


platformChatId ​

Get Signature ​

get platformChatId(): string

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:336

Returns ​

string

Implementation of ​

ShownPlayer.platformChatId


skin ​

Get Signature ​

get skin(): Skin | null

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:344

Returns ​

Skin | null

Implementation of ​

ShownPlayer.skin


xuid ​

Get Signature ​

get xuid(): string

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:332

Returns ​

string

Implementation of ​

ShownPlayer.xuid


yaw ​

Get Signature ​

get yaw(): number

Defined in: packages/prismarine/src/entity/data/storeActors.ts:190

Returns ​

number

Implementation of ​

ShownPlayer.yaw

Inherited from ​

StoreActor.yaw

Methods ​

addStatusEffect() ​

addStatusEffect(input, notify?): boolean

Defined in: packages/prismarine/src/entity/data/storeActors.ts:353

Applies or refreshes a status effect in the store, unless the entity's minecraft:mob_effect_immunity refuses it, merging with an effect already running.

Parameters ​

input ​

StatusEffectInput

notify? ​

boolean = true

Whether to tell clients about an accepted change.

Returns ​

boolean

Whether the effect changed.

Inherited from ​

StoreActor.addStatusEffect


addTag() ​

addTag(tag): boolean

Defined in: packages/prismarine/src/entity/data/storeActors.ts:325

Adds a /tag tag.

Parameters ​

tag ​

string

Returns ​

boolean

Whether the entity did not already carry it.

Inherited from ​

StoreActor.addTag


applyImpulse() ​

applyImpulse(impulse): void

Defined in: packages/prismarine/src/entity/data/storeActors.ts:303

Adds an impulse to the entity body the runtime integrates each tick.

Parameters ​

impulse ​

EntityPosition

Returns ​

void

Inherited from ​

StoreActor.applyImpulse


applyKnockback() ​

applyKnockback(directionX, directionZ, strength, damping?): void

Defined in: packages/prismarine/src/entity/data/storeActors.ts:312

Shoves the entity: vanilla's rule is that each shove halves whatever motion the last one left before adding its own, which is what makes a sprint hit both throw harder and cancel more of the run the target was making.

Parameters ​

directionX ​

number

directionZ ​

number

strength ​

number

damping? ​

number = 0.5

Returns ​

void

Inherited from ​

StoreActor.applyKnockback


claimUpdate() ​

claimUpdate(tick): boolean

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:249

Claims the player's one update of a tick, which an actor in another world shares.

Parameters ​

tick ​

number

Returns ​

boolean

Overrides ​

StoreActor.claimUpdate


clearStatusEffects() ​

clearStatusEffects(notify?): number

Defined in: packages/prismarine/src/entity/data/storeActors.ts:389

Removes every active status effect.

Parameters ​

notify? ​

boolean = true

Returns ​

number

How many were cleared.

Inherited from ​

StoreActor.clearStatusEffects


damage() ​

damage(amount, source?): Promise<boolean>

Defined in: packages/prismarine/src/entity/data/storeActors.ts:281

Hands a blow to the store's damage pipeline, which decides it and applies it before this returns.

Parameters ​

amount ​

number

source? ​

DamageCause | DamageSource = DamageCause.Generic

Returns ​

Promise<boolean>

Inherited from ​

StoreActor.damage


getBox() ​

getBox(): EntityBox

Defined in: packages/prismarine/src/entity/data/storeActors.ts:233

How big the entity is, from its type's collision box.

Returns ​

EntityBox

Inherited from ​

StoreActor.getBox


getCommandLevel() ​

getCommandLevel(): CommandPermissionLevel

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:358

The command level the player runs at, which sets the command permission other clients see.

Returns ​

CommandPermissionLevel

Implementation of ​

ShownPlayer.getCommandLevel


getDefaultPortalCooldown() ​

getDefaultPortalCooldown(): number

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:284

Half a second, where a mob waits fifteen: Player.getDimensionChangingDelay in vanilla.

Returns ​

number

Overrides ​

StoreActor.getDefaultPortalCooldown


getEquipment() ​

getEquipment(): ViewableEquipment

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:318

What the player holds and wears, from its inventory.

Returns ​

ViewableEquipment

Implementation of ​

ShownPlayer.getEquipment

Overrides ​

StoreActor.getEquipment


getFeetY() ​

getFeetY(): number

Defined in: packages/prismarine/src/entity/data/storeActors.ts:228

Where the bottom of the body is, which for a store entity is its position.

Returns ​

number

Inherited from ​

StoreActor.getFeetY


getHealth() ​

getHealth(): number

Defined in: packages/prismarine/src/entity/data/storeActors.ts:248

The entity's health in the store, or zero for a type with no health.

Returns ​

number

Inherited from ​

StoreActor.getHealth


getMaxHealth() ​

getMaxHealth(): number

Defined in: packages/prismarine/src/entity/data/storeActors.ts:253

The entity's maximum health in the store, or zero for a type with no health.

Returns ​

number

Inherited from ​

StoreActor.getMaxHealth


getName() ​

getName(): string

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:328

The name the login carried.

Returns ​

string

Implementation of ​

ShownPlayer.getName

Overrides ​

StoreActor.getName


getPortalCooldown() ​

getPortalCooldown(): number

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:289

The player's cooldown, which it keeps from one store to the next and in its record.

Returns ​

number

Overrides ​

StoreActor.getPortalCooldown


getPortalTransitionTicks() ​

getPortalTransitionTicks(rule?): number

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:277

Ticks this player has to stand in a portal before going through.

Vanilla reads players_nether_portal_creative_delay (0) for a creative player and players_nether_portal_default_delay (80) for everyone else; the game rules are not modeled yet, so the portal rule's defaults are the answer. An end portal's rule says 0 for both.

Parameters ​

rule? ​

PortalRule

The rule of the portal stood in. Without one, a nether portal is assumed.

Returns ​

number

Overrides ​

StoreActor.getPortalTransitionTicks


getPosition() ​

getPosition(): Vector3

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:308

Where the player's eyes are, which is where a client draws a player and where a legacy player is.

Returns ​

Vector3

Implementation of ​

ShownPlayer.getPosition

Overrides ​

StoreActor.getPosition


getRuntimeId() ​

getRuntimeId(): bigint

Defined in: packages/prismarine/src/entity/data/storeActors.ts:166

Returns ​

bigint

Inherit Doc ​

Implementation of ​

ShownPlayer.getRuntimeId

Inherited from ​

StoreActor.getRuntimeId


getServer() ​

getServer(): Server

Defined in: packages/prismarine/src/entity/data/storeActors.ts:161

The server the world belongs to.

Returns ​

Server

Inherited from ​

StoreActor.getServer


getStatusEffect() ​

getStatusEffect(identifier): StatusEffect | undefined

Defined in: packages/prismarine/src/entity/data/storeActors.ts:337

One active effect by its namespaced id or bare Bedrock name.

Parameters ​

identifier ​

string

Returns ​

StatusEffect | undefined

Inherited from ​

StoreActor.getStatusEffect


getStatusEffects() ​

getStatusEffects(): readonly StatusEffect[]

Defined in: packages/prismarine/src/entity/data/storeActors.ts:218

Returns ​

readonly StatusEffect[]

Inherit Doc ​

Implementation of ​

ShownPlayer.getStatusEffects

Inherited from ​

StoreActor.getStatusEffects


getSyncedProperties() ​

getSyncedProperties(): SyncedProperties

Defined in: packages/prismarine/src/entity/data/storeActors.ts:208

Returns ​

SyncedProperties

Inherit Doc ​

Implementation of ​

ShownPlayer.getSyncedProperties

Inherited from ​

StoreActor.getSyncedProperties


getTags() ​

getTags(): readonly string[]

Defined in: packages/prismarine/src/entity/data/storeActors.ts:320

The /tag tags of the entity.

Returns ​

readonly string[]

Inherited from ​

StoreActor.getTags


getType() ​

getType(): string

Defined in: packages/prismarine/src/entity/data/storeActors.ts:171

Returns ​

string

Inherit Doc ​

Implementation of ​

ShownPlayer.getType

Inherited from ​

StoreActor.getType


getUUID() ​

getUUID(): UUIDValue

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:323

The identity the client logged in with.

Returns ​

UUIDValue

Implementation of ​

ShownPlayer.getUUID


getVelocity() ​

getVelocity(): Vector3

Defined in: packages/prismarine/src/entity/data/storeActors.ts:182

Returns ​

Vector3

Inherit Doc ​

Implementation of ​

ShownPlayer.getVelocity

Inherited from ​

StoreActor.getVelocity


getWorld() ​

getWorld(): World

Defined in: packages/prismarine/src/entity/data/storeActors.ts:156

The world the entity stands in.

Returns ​

World

Inherited from ​

StoreActor.getWorld


hasStatusEffect() ​

hasStatusEffect(identifier): boolean

Defined in: packages/prismarine/src/entity/data/storeActors.ts:342

Whether one status effect is active.

Parameters ​

identifier ​

string

Returns ​

boolean

Inherited from ​

StoreActor.hasStatusEffect


heal() ​

heal(amount): Promise<boolean>

Defined in: packages/prismarine/src/entity/data/storeActors.ts:298

Heals the entity in the store.

Parameters ​

amount ​

number

Returns ​

Promise<boolean>

Inherited from ​

StoreActor.heal


isAlive() ​

isAlive(): boolean

Defined in: packages/prismarine/src/entity/data/storeActors.ts:258

Whether the entity is still in the store and has health left.

Returns ​

boolean

Inherited from ​

StoreActor.isAlive


isAttackable() ​

isAttackable(): boolean

Defined in: packages/prismarine/src/entity/data/storeActors.ts:266

Whether a blow can land on the entity: one with health left, or a boat or minecart, which has none and breaks from the damage blows add up to, as Java's VehicleEntity does.

Returns ​

boolean

Inherited from ​

StoreActor.isAttackable


isFlying() ​

isFlying(): boolean

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:363

Returns ​

boolean

Inherit Doc ​

Implementation of ​

ShownPlayer.isFlying


isOnGround() ​

isOnGround(): boolean

Defined in: packages/prismarine/src/entity/data/storeActors.ts:223

Returns ​

boolean

Inherit Doc ​

Implementation of ​

ShownPlayer.isOnGround

Inherited from ​

StoreActor.isOnGround


isOnPortalCooldown() ​

isOnPortalCooldown(): boolean

Defined in: packages/prismarine/src/entity/data/storeActors.ts:431

Whether the entity still refuses portals after a recent dimension change.

Returns ​

boolean

Inherited from ​

StoreActor.isOnPortalCooldown


isOp() ​

isOp(): boolean

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:353

Whether the permission service lists the player as an operator.

Returns ​

boolean

Implementation of ​

ShownPlayer.isOp


portalContact() ​

portalContact(): PortalContact | undefined

Defined in: packages/prismarine/src/entity/data/storeActors.ts:444

The portal the entity is in contact with, if any.

Returns ​

PortalContact | undefined

Inherited from ​

StoreActor.portalContact


projectMetadata() ​

projectMetadata(leashHolderId?): ActorMetadataProjection

Defined in: packages/prismarine/src/entity/data/storeActors.ts:203

The actor metadata the store state projects to, which StoreActor.metadata writes.

Parameters ​

leashHolderId? ​

number

The runtime id of whatever holds the entity's leash.

Returns ​

ActorMetadataProjection

Inherited from ​

StoreActor.projectMetadata


removeStatusEffect() ​

removeStatusEffect(identifier, notify?): boolean

Defined in: packages/prismarine/src/entity/data/storeActors.ts:380

Removes one status effect.

Parameters ​

identifier ​

string

notify? ​

boolean = true

Returns ​

boolean

Whether an active effect was removed.

Inherited from ​

StoreActor.removeStatusEffect


removeTag() ​

removeTag(tag): boolean

Defined in: packages/prismarine/src/entity/data/storeActors.ts:332

Takes a /tag tag off.

Parameters ​

tag ​

string

Returns ​

boolean

Whether the entity carried it.

Inherited from ​

StoreActor.removeTag


setHealth() ​

setHealth(health, source?): Promise<void>

Defined in: packages/prismarine/src/entity/data/storeActors.ts:290

A health written onto the entity: a lower one, which is what /kill writes, is a blow for the difference through the store's pipeline, and a higher one is a heal.

Parameters ​

health ​

number

source? ​

DamageCause | DamageSource = DamageCause.Generic

Returns ​

Promise<void>

Inherited from ​

StoreActor.setHealth


setName() ​

setName(name): void

Defined in: packages/prismarine/src/entity/data/storeActors.ts:243

Names the entity in the store, which shows it to clients.

Parameters ​

name ​

string

Returns ​

void

Inherited from ​

StoreActor.setName


setPortalCooldown() ​

setPortalCooldown(ticks?): void

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:294

Starts the portal cooldown, on arrival through a portal.

Parameters ​

ticks? ​

number = ...

Returns ​

void

Overrides ​

StoreActor.setPortalCooldown


shouldPersist() ​

shouldPersist(): boolean

Defined in: packages/prismarine/src/entity/data/storeActors.ts:273

Whether a save writes the entity, which Bedrock's minecraft:transient turns off.

Returns ​

boolean

Inherited from ​

StoreActor.shouldPersist


toString() ​

toString(): string

Defined in: packages/prismarine/src/entity/data/storeActors.ts:151

The entity as /debug lists it.

Returns ​

string

Inherited from ​

StoreActor.toString


touchPortal() ​

touchPortal(at, portal?): void

Defined in: packages/prismarine/src/entity/data/storeActors.ts:452

Records that the entity overlaps a portal block this tick: a touch on cooldown winds the cooldown back instead of opening a contact.

Parameters ​

at ​

Vector3

portal? ​

PortalBlockRef

Returns ​

void

Inherited from ​

StoreActor.touchPortal


update() ​

update(tick): void

Defined in: packages/prismarine/src/entity/data/storePlayers.ts:257

The entity's part of the tick, then the player's own: its session, its attribute sync and its triggers, which run for the player the session speaks for.

Parameters ​

tick ​

number

Returns ​

void

Overrides ​

StoreActor.update