Skip to content

API reference / @jsprismarine/prismarine / entity/data/droppedItems / DroppedItems

Class: DroppedItems ​

Defined in: packages/prismarine/src/entity/data/droppedItems.ts:367

The dropped stacks of one runtime, and the system that runs each of them once a tick.

Constructors ​

Constructor ​

new DroppedItems(host): DroppedItems

Defined in: packages/prismarine/src/entity/data/droppedItems.ts:368

Parameters ​

host ​

DroppedItemsHost

Returns ​

DroppedItems

Methods ​

hurt() ​

hurt(entity, amount, cause): boolean

Defined in: packages/prismarine/src/entity/data/droppedItems.ts:451

Hurts a dropped stack through the store's damage pipeline, which takes health off it with no grace period, as Java's ItemEntity.hurt, and removes it when it dies.

Parameters ​

entity ​

DataEntity

amount ​

number

cause ​

string

Returns ​

boolean

Whether the blow landed.

Java Source ​

Entity.hurt


isValid() ​

isValid(entity): boolean

Defined in: packages/prismarine/src/entity/data/droppedItems.ts:398

Whether an entity is either no dropped stack or one with a stack, so it may enter the world.

Parameters ​

entity ​

DataEntity

Returns ​

boolean


remove() ​

remove(id, reason): void

Defined in: packages/prismarine/src/entity/data/droppedItems.ts:393

Takes a stack out of the store, which a kill does.

Parameters ​

id ​

number

reason ​

string

Returns ​

void


resistsDamage() ​

resistsDamage(entity, cause): boolean

Defined in: packages/prismarine/src/entity/data/droppedItems.ts:462

Whether a stack survives a kind of damage, because its item's minecraft:damage_resistant names the damage: netherite survives fire and a nether star a blast. The store's damage pipeline asks this as a guard, so a blast the runtime deals is turned aside too.

Parameters ​

entity ​

DataEntity

cause ​

string

The cause, by the server's name or Bedrock's.

Returns ​

boolean


spawn() ​

spawn(lying, start): DataEntity | undefined

Defined in: packages/prismarine/src/entity/data/droppedItems.ts:377

Puts a stack on the ground.

Parameters ​

lying ​

EntityPosition

Where the stack lies; the entity reports itself the definition's position_offset above it.

start ​

ItemStart

Returns ​

DataEntity | undefined

The entity, or undefined when the content declares no dropped item or the stack is empty.


take() ​

take(id, count?): StoredItemStack | undefined

Defined in: packages/prismarine/src/entity/data/droppedItems.ts:472

Takes up to count items out of a stack, which is what a mob picking it up does.

Parameters ​

id ​

number

count? ​

number

Returns ​

StoredItemStack | undefined

The stack that was taken, or undefined when nothing of that id lies there.


update() ​

update(entity): void

Defined in: packages/prismarine/src/entity/data/droppedItems.ts:406

One dropped stack's tick, in the order the legacy item ran it: age and despawn, the pickup delay, the move, then hazards, a merge and a pickup.

Parameters ​

entity ​

DataEntity

Returns ​

void