Skip to content

helix / BlockValue

Class: BlockValue

Defined in: core/values/block.ts:26

A domain concept that renders to a single command token (a position, a block, an item, ...). Rendering is deferred to codegen and given the target version, so a concept can encode itself differently per version (e.g. item data components vs NBT) - the author programs with the concept, not the string.

Implements

Constructors

Constructor

new BlockValue(id, states?): BlockValue

Defined in: core/values/block.ts:30

Parameters

id

string

states?

BlockStates

Returns

BlockValue

Methods

data()

data(nbt): this

Defined in: core/values/block.ts:42

Parameters

nbt

string

Returns

this


render()

render(): string

Defined in: core/values/block.ts:47

Returns

string

Implementation of

CommandValue.render


state()

state(props): this

Defined in: core/values/block.ts:37

Parameters

props

BlockStates

Returns

this


toBlockState()

toBlockState(): object

Defined in: core/values/block.ts:62

The NBT compound form used by block_display / block_state fields ({Name, Properties}), as opposed to the id[state] string form render produces. Property values are stringified, as the format requires.

Returns

object

Name

Name: string

Properties?

optional Properties?: Record<string, string>

Released under the MIT License · Credits