Skip to content

API reference / @jsprismarine/prismarine / item/Item

item/Item ​

Classes ​

Interfaces ​

ItemProps ​

Defined in: packages/prismarine/src/item/Item.ts:52

Properties ​

blockRuntimeId? ​

optional blockRuntimeId?: number

Defined in: packages/prismarine/src/item/Item.ts:65

The runtime id of the block state this stack places, when the name alone would get it wrong. Vanilla's creative menu shows a piston facing up and sends a door with no block at all, so a creative entry passes its own number rather than resolving its default state.

canDestroyBlocks? ​

optional canDestroyBlocks?: readonly string[]

Defined in: packages/prismarine/src/item/Item.ts:80

Bedrock block identifiers this stack may destroy in adventure mode.

canPlaceOnBlocks? ​

optional canPlaceOnBlocks?: readonly string[]

Defined in: packages/prismarine/src/item/Item.ts:78

Bedrock block identifiers this stack may be placed on in adventure mode.

components? ​

optional components?: Readonly<Record<string, unknown>>

Defined in: packages/prismarine/src/item/Item.ts:95

The stack's other Java data components, such as minecraft:trim or minecraft:firework_explosion; see Item.getComponents. A component the other props hold is left out.

content? ​

optional content?: ServerContent

Defined in: packages/prismarine/src/item/Item.ts:67

The content the item's components are read from, when the server built one.

contents? ​

optional contents?: readonly (Item | null)[]

Defined in: packages/prismarine/src/item/Item.ts:87

What a container item holds, one entry per slot and null for an empty one.

Java's minecraft:container. A shulker box carries its whole inventory here between being broken and being placed again.

count? ​

optional count?: number

Defined in: packages/prismarine/src/item/Item.ts:58

customName? ​

optional customName?: string

Defined in: packages/prismarine/src/item/Item.ts:74

The name an anvil gave the stack, which replaces the item's own on the client.

durability? ​

optional durability?: number

Defined in: packages/prismarine/src/item/Item.ts:59

enchantments? ​

optional enchantments?: Readonly<Record<string, number>> | ReadonlyMap<string, number>

Defined in: packages/prismarine/src/item/Item.ts:72

Enchantments on the stack, as Java's minecraft:enchantments component holds them: namespaced enchantment id to level.

lore? ​

optional lore?: readonly string[]

Defined in: packages/prismarine/src/item/Item.ts:76

The lines an item modifier wrote under the name.

mapId? ​

optional mapId?: number

Defined in: packages/prismarine/src/item/Item.ts:89

Which saved map a filled map shows, Java's minecraft:map_id; see Item.getMapId.

meta? ​

optional meta?: number

Defined in: packages/prismarine/src/item/Item.ts:56

name ​

name: string

Defined in: packages/prismarine/src/item/Item.ts:55

nbt? ​

optional nbt?: unknown

Defined in: packages/prismarine/src/item/Item.ts:57

runtimeId? ​

optional runtimeId?: number

Defined in: packages/prismarine/src/item/Item.ts:54

The Bedrock runtime id to retain when the item name is not in the vanilla table.

Functions ​

maxStackSizeOf() ​

maxStackSizeOf(name, content?): number

Defined in: packages/prismarine/src/item/Item.ts:136

The most of one item a stack holds, from minecraft:max_stack_size.

Parameters ​

name ​

string

The item identifier.

content? ​

ServerContent

The content build; Java's committed table when absent.

Returns ​

number

The stack size.


resistsDamageOf() ​

resistsDamageOf(name, damage, content?): boolean

Defined in: packages/prismarine/src/item/Item.ts:148

Whether a dropped stack of an item survives a kind of damage, from Java's minecraft:damage_resistant: netherite names #minecraft:is_fire and a nether star #minecraft:is_explosion.

Parameters ​

name ​

string

The item identifier.

damage ​

string

The damage type tag, such as minecraft:is_fire, or a damage type.

content? ​

ServerContent

The content build; Java's committed table when absent.

Returns ​

boolean

Whether the stack survives it.