Skip to content

API reference / @jsprismarine/prismarine / entity/data/itemActor / ItemActor

Class: ItemActor ​

Defined in: packages/prismarine/src/entity/data/itemActor.ts:41

The actor of one dropped stack of the store.

Extends ​

Constructors ​

Constructor ​

new ItemActor(entity, world, blows, items): ItemActor

Defined in: packages/prismarine/src/entity/data/itemActor.ts:48

Parameters ​

entity ​

DataEntity

The store entity of the stack.

world ​

World

The world it lies in.

blows ​

StoreActorBlows

Where the actor sends heals and written health.

items ​

DroppedItems

The system a blow is handed to.

Returns ​

ItemActor

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 ​

InertActor.entity

Accessors ​

attributes ​

Get Signature ​

get attributes(): Attributes

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

The defaults, as the stack was given them: a stack's health is not shown.

Returns ​

Attributes

The attributes a client is sent.

Overrides ​

StoreActor.attributes


headYaw ​

Get Signature ​

get headYaw(): number

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

Where the entity's head faces, which a look turns apart from its body.

Returns ​

number

Inherited from ​

StoreActor.headYaw


metadata ​

Get Signature ​

get metadata(): Metadata

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

The actor metadata the store state projects to now, with the type's box: what a player's own client and a save read. It leaves out who holds the entity's leash, which only other clients are shown, and they are sent the replica's metadata.

Returns ​

Metadata

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

Inherited from ​

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

Inherited from ​

StoreActor.pitch


yaw ​

Get Signature ​

get yaw(): number

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

Returns ​

number

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/storeActors.ts:462

Claims the entity's one update of a server tick, so a world that ticks it twice runs it once.

Parameters ​

tick ​

number

Returns ​

boolean

Inherited from ​

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/itemActor.ts:103

A blow goes to the dropped item system, which takes the stack's health with no grace period.

Parameters ​

amount ​

number

source? ​

DamageCause | DamageSource = DamageCause.Generic

Returns ​

Promise<boolean>

Overrides ​

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


getDefaultPortalCooldown() ​

getDefaultPortalCooldown(): number

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

How long the entity refuses portals after a dimension change: a player's half second for a boat, a raft or a minecart and for an entity a player rides in front of, fifteen seconds for anything else.

Returns ​

number

Inherited from ​

StoreActor.getDefaultPortalCooldown


getEquipment() ​

getEquipment(): ViewableEquipment

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

Returns ​

ViewableEquipment

Inherit Doc ​

Inherited from ​

StoreActor.getEquipment


getFeetY() ​

getFeetY(): number

Defined in: packages/prismarine/src/entity/data/itemActor.ts:85

Where the item lies, below the position it reports.

Returns ​

number

Overrides ​

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


getItem() ​

getItem(): Item | undefined

Defined in: packages/prismarine/src/entity/data/itemActor.ts:67

The stack a player picks up, as the item actor packet carries it.

Returns ​

Item | undefined


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


getMotion() ​

getMotion(): Vector3

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

The speed it is moving at, in blocks per tick, which the client is told when it appears.

Returns ​

Vector3


getName() ​

getName(): string

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

The entity's name tag, or an empty string when it has none.

Returns ​

string

Inherited from ​

StoreActor.getName


getPortalCooldown() ​

getPortalCooldown(): number

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

Ticks left before the entity may enter a portal again.

Returns ​

number

Inherited from ​

StoreActor.getPortalCooldown


getPortalTransitionTicks() ​

getPortalTransitionTicks(_rule?): number

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

Ticks a non-player entity waits in a portal before it goes through, which is none.

Parameters ​

_rule? ​

PortalRule

Returns ​

number

Inherited from ​

StoreActor.getPortalTransitionTicks


getPosition() ​

getPosition(): Vector3

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

Returns ​

Vector3

Inherit Doc ​

Inherited from ​

StoreActor.getPosition


getRuntimeId() ​

getRuntimeId(): bigint

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

Returns ​

bigint

Inherit Doc ​

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 ​

Inherited from ​

StoreActor.getStatusEffects


getSyncedProperties() ​

getSyncedProperties(): SyncedProperties

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

Returns ​

SyncedProperties

Inherit Doc ​

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 ​

Inherited from ​

StoreActor.getType


getVelocity() ​

getVelocity(): Vector3

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

Returns ​

Vector3

Inherit Doc ​

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


isOnGround() ​

isOnGround(): boolean

Defined in: packages/prismarine/src/entity/data/itemActor.ts:93

The client draws a stack's landing from its own guess, so a stack is never said to be on the ground.

Returns ​

boolean

Overrides ​

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


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/itemActor.ts:98

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

Overrides ​

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


savedItem() ​

savedItem(): SavedItem | undefined

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

What the item's actor record holds beside the fields every actor has.

Returns ​

SavedItem | undefined


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/storeActors.ts:426

Starts the portal cooldown, on arrival through a portal.

Parameters ​

ticks? ​

number = ...

Returns ​

void

Inherited from ​

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/storeActors.ts:473

The part of a tick the store does not run yet: the portal clock, the start of a trip through a portal once the contact is ready, and the status effects, whose harm and healing go through the store.

Parameters ​

tick ​

number

Returns ​

void

Inherited from ​

StoreActor.update