Skip to content

API reference / @jsprismarine/block-behaviors / TestItem

Class: TestItem ​

Defined in: block-behaviors/src/harness.ts:52

A held item built from an identifier and a component map, which is all a block behavior reads off one.

It ships with the harness because a test for waxing, scraping, shearing or silk touch needs a HookItem and nothing smaller exists. A server passes its own ItemStack instead; both satisfy the same interface.

Implements ​

Constructors ​

Constructor ​

new TestItem(identifier, components?): TestItem

Defined in: block-behaviors/src/harness.ts:58

Parameters ​

identifier ​

string

The namespaced item identifier.

components? ​

Readonly<Record<string, unknown>> = {}

The item's components, keyed by name, as the schemas parse them.

Returns ​

TestItem

Properties ​

identifier ​

readonly identifier: string

Defined in: block-behaviors/src/harness.ts:59

The namespaced item identifier.

Implementation of ​

HookItem.identifier

Methods ​

get() ​

get(name): unknown

Defined in: block-behaviors/src/harness.ts:64

One component's value, or undefined when the item does not carry it.

Parameters ​

name ​

string

Returns ​

unknown

Implementation of ​

HookItem.get