Skip to content

API reference / @jsprismarine/prismarine / entity/data/DataEntity

entity/data/DataEntity ​

Classes ​

Interfaces ​

DataEntityOptions ​

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1390

What a caller says about an entity it creates.

Properties ​

body ​

readonly body: MobBody

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1391

brain? ​

readonly optional brain?: Brain

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1400

The brain itself, built from DataEntityOptions.brainMob.

brainMob? ​

readonly optional brainMob?: BrainMobDefinition

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1398

The brain definition for one of the twenty Java brain mobs, when the type is one.

instance ​

readonly instance: EntityInstance

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1392

persistentIdentity? ​

readonly optional persistentIdentity?: string

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1394

Stable identity used to restore relationships that survive a server session.

spawnData? ​

readonly optional spawnData?: Readonly<Record<string, unknown>>

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1396

Entity-specific fields supplied by the source that spawned it.


LoggedBodyState ​

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:174

The body fields a save or a replay digest reads, each held once and written through one setter that reports the change (MobBody.onWrite).

Properties ​

actorTags ​

actorTags: Uint8Array<ArrayBufferLike> | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:210

The actor record tags this server does not model, as network NBT bytes, which the next save writes back, such as the actor's UniqueID.

beamTarget ​

beamTarget: EntityPosition | undefined

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

breedCooldown ​

breedCooldown: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:189

canPickUpLoot ​

canPickUpLoot: boolean | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:194

color ​

color: number | undefined

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

curedBy ​

curedBy: string | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:185

deathTime ​

deathTime: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:201

Ticks since the entity died, Java's DeathTime; 0 while it lives.

fireTicks ​

fireTicks: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:199

fuseTicks ​

fuseTicks: number | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:196

headYaw ​

headYaw: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:178

Where the head faces, in degrees, which a look turns apart from the body: Java's yHeadRot.

home ​

home: EntityPosition | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:183

inventorySize ​

inventorySize: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:224

How many slots the inventory container has, which the active minecraft:inventory decides. Logged so that undoing a shrink gives the slots back before the slot entries that emptied them are written back into them.

invulnerable ​

invulnerable: boolean

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:195

loveTicks ​

loveTicks: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:188

nameTag ​

nameTag: string | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:181

owner ​

owner: number | undefined

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

The online owner's runtime id, or undefined while its owner is offline or absent.

ownerIdentity ​

ownerIdentity: string | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:184

paddles ​

paddles: number

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

Which paddles a boat's controller rows with, as riding.ts's paddle bits.

pitch ​

pitch: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:179

position ​

position: EntityPosition

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:175

projectileAge ​

projectileAge: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:211

projectileStuck ​

projectileStuck: boolean

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

seat ​

seat: RiderSeat | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:226

The seat a rider sits in, as its last vehicle placed it, or undefined for one that never rode.

showBottom ​

showBottom: boolean | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:193

sitting ​

sitting: boolean

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

sleeping ​

sleeping: boolean

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:187

sleepingPos ​

sleepingPos: EntityPosition | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:192

The bed a body lies in, or undefined while it is up: see DataEntity.sleepingPos.

statusEffectClock ​

statusEffectClock: StatusEffectClock | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:205

The status effect clock, as its reading at one update (StatusEffectClock).

steeredBy ​

steeredBy: number | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:230

The player steering this vehicle, whose client moves it, or undefined while none does.

teleports ​

teleports: number

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

How many times the server has moved the entity instantly (MobBody.teleportTo). Only a change is read: a tick that writes it tells clients to snap to the entity's new place instead of gliding there.

tradeTier ​

tradeTier: number | undefined

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:198

A trader's level, from zero, or undefined for an entity that has not drawn offers.

velocity ​

velocity: EntityPosition

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:180

yaw ​

yaw: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:176


MobBodyStepOptions ​

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:62

The movement rules the world supplies when a body takes its step.

Properties ​

allowVertical ​

readonly allowVertical: boolean

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:64

Whether this entity's active navigation may move freely on the vertical axis.

canJump ​

readonly canJump: boolean

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:66

Whether the active navigation component permits a jump.

canOccupy ​

readonly canOccupy: (position) => boolean

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:82

Whether the entity's collision box fits at the proposed position.

Parameters ​
position ​

EntityPosition

Returns ​

boolean

floorAt? ​

readonly optional floorAt?: (waypoint) => number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:95

Where a body standing at a waypoint has its feet. A path waypoint sits on top of the cell below it, and a slab or a carpet there holds the feet lower than that.

Parameters ​
waypoint ​

EntityPosition

Returns ​

number

groundFriction ​

readonly groundFriction: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:84

The Java friction of the block under the entity, which a walk on land accelerates against.

maxDescent? ​

readonly optional maxDescent?: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:80

The farthest the step may take the body down, Java's 0.15 for a body in a ladder. Absent means no limit.

maxTurn? ​

readonly optional maxTurn?: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:107

The most degrees the entity's move control turns its body toward the waypoint in one tick, 90 for Java's MoveControl. A walker that has to turn further walks along the heading it reached, as Java's travel moves a mob along its body's facing. Absent turns the entity at once.

maxUpStep? ​

readonly optional maxUpStep?: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:73

How high the entity's feet rise over a ledge without a jump, Java's step_height attribute for its type. Absent means MAX_UP_STEP, Java's default.

nextHopDelay? ​

readonly optional nextHopDelay?: () => number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:100

Draws how many ticks the entity waits on the ground before its next hop, for a mob that moves by hopping, as minecraft:movement.jump does. Absent for a mob that walks.

Returns ​

number

speedFactor? ​

readonly optional speedFactor?: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:90

The block speed factor under the entity, Java's Entity.getBlockSpeedFactor. Absent means 1.

Java See ​

Entity.getBlockSpeedFactor

stepHeight ​

readonly stepHeight: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:68

The height of one step the entity may jump, in blocks.

stuckSpeed? ​

readonly optional stuckSpeed?: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:78

The share of this tick's walk a block the body is stuck in lets through, Java's Entity.stuckSpeedMultiplier: a cobweb's 0.25. Absent when nothing holds the body.

turnShare? ​

readonly optional turnShare?: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:116

The share of the remaining turn toward the waypoint the body takes each tick, for a mob that eases its own body rather than having a move control turn it: Java's Squid.aiStep eases a tenth of the way. The mob moves toward the waypoint whatever it faces. Takes precedence over MobBodyStepOptions.maxTurn.

Java See ​

Squid.aiStep

Type Aliases ​

BodySlotObserver ​

BodySlotObserver = (container, slot, before, after) => void

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:261

What MobBody.onSlotWrite receives: one slot the body carries, with its value before and after.

Parameters ​

container ​

InventoryContainer

slot ​

number

before ​

SlotValue

after ​

SlotValue

Returns ​

void


BodyWriteObserver ​

BodyWriteObserver = (field, before, after) => void

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

What MobBody.onWrite receives: one field, with its value before and after a change.

Parameters ​

field ​

LoggedBodyField

before ​

unknown

after ​

unknown

Returns ​

void


LoggedBodyField ​

LoggedBodyField = keyof LoggedBodyState | "tags" | "statusEffects" | "equipmentInventorySlots" | `condition:${ShownCondition}`

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:254

The name of one LoggedBodyState field, or of a collection the body reports.


RiderSeat ​

RiderSeat = object

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:162

Where a rider sits on its vehicle, as a Bedrock client is shown it: the offset from the vehicle, and how far the rider may turn from the seat's facing and is turned by it.

Properties ​

lockDegrees ​

readonly lockDegrees: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:165

lock_rider_rotation, in degrees; 181 locks nothing.

offset ​

readonly offset: object

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:163

x ​

readonly x: number

y ​

readonly y: number

z ​

readonly z: number

rotationDegrees ​

readonly rotationDegrees: number | null

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:167

rotate_rider_by for this rider, in degrees, or null for a seat that turns nobody.


ShownCondition ​

ShownCondition = typeof SHOWN_CONDITIONS[number]

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

One of SHOWN_CONDITIONS.


StatusEffectClock ​

StatusEffectClock = object

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:239

How many ticks an entity's status effects have been ticked, which is the clock of an effect that never runs out, logged as its reading at one update: age at the update of tick tick, and one more for each tick since while the updates run tick after tick. So it is written at the entity's first update and after a gap, and not every tick.

Properties ​

age ​

readonly age: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:239

tick ​

readonly tick: number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:239

Variables ​

SHOWN_CONDITIONS ​

const SHOWN_CONDITIONS: readonly ["in_water", "on_ground"]

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:245

The conditions a client is shown, out of the many a body keeps: being in water, which a swimming mob's metadata shows, and standing on the ground, which a move carries.

Functions ​

conditionField() ​

conditionField(condition): "condition:in_water" | "condition:on_ground"

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:251

The logged field of a shown condition, which holds whether the body has it.

Parameters ​

condition ​

"in_water" | "on_ground"

Returns ​

"condition:in_water" | "condition:on_ground"


distance() ​

distance(from, to): number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1496

The straight-line distance between two positions.

Parameters ​

from ​

EntityPosition

to ​

EntityPosition

Returns ​

number


squaredDistance() ​

squaredDistance(from, to): number

Defined in: packages/prismarine/src/entity/data/DataEntity.ts:1512

The square of the straight-line distance between two positions.

Squaring orders positions the same way the distance does and costs three multiplications instead of a Math.hypot, so a scan that only compares, either against a radius or against another candidate, uses this. Use distance wherever the number itself is the answer, because a squared distance is not one.

Parameters ​

from ​

EntityPosition

to ​

EntityPosition

Returns ​

number