Skip to content

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

entity/data/itemInteraction ​

Type Aliases ​

EntityItemInteraction ​

EntityItemInteraction = { accepted: false; } | { accepted: true; addedItems?: readonly ItemDrop[]; consumeItem?: boolean; hurtItem?: number; particleOnStart?: { offsetTowardsInteractor: boolean; particleType: string; yOffset: number; }; resultItem?: string; resultItemData?: number; statusEffects?: readonly EntityItemStatusEffect[]; swing?: boolean; takenItem?: ItemDrop; }

Defined in: packages/prismarine/src/entity/data/itemInteraction.ts:5

The outcome of applying a player's held item to a data-driven entity.

Union Members ​

Type Literal ​

{ accepted: false; }


Type Literal ​

{ accepted: true; addedItems?: readonly ItemDrop[]; consumeItem?: boolean; hurtItem?: number; particleOnStart?: { offsetTowardsInteractor: boolean; particleType: string; yOffset: number; }; resultItem?: string; resultItemData?: number; statusEffects?: readonly EntityItemStatusEffect[]; swing?: boolean; takenItem?: ItemDrop; }

accepted ​

readonly accepted: true

addedItems? ​

readonly optional addedItems?: readonly ItemDrop[]

Items a data-defined interaction adds to the player's inventory.

consumeItem? ​

readonly optional consumeItem?: boolean

hurtItem? ​

readonly optional hurtItem?: number

Durability to remove from the player's held item.

particleOnStart? ​

readonly optional particleOnStart?: object

The named particle effect emitted when the interaction starts.

particleOnStart.offsetTowardsInteractor ​

readonly offsetTowardsInteractor: boolean

particleOnStart.particleType ​

readonly particleType: string

particleOnStart.yOffset ​

readonly yOffset: number

resultItem? ​

readonly optional resultItem?: string

resultItemData? ​

readonly optional resultItemData?: number

statusEffects? ​

readonly optional statusEffects?: readonly EntityItemStatusEffect[]

Status effects applied by the accepted entity interaction.

swing? ​

readonly optional swing?: boolean

Whether the other viewers see the interacting player's arm swing.

takenItem? ​

readonly optional takenItem?: ItemDrop

The entity item moved into the player's previously empty selected slot.