Alpha: this compiler is under active development and updates will break your projects. Not recommended for real use yet.
Skip to content

helix / BlockState

Class: BlockState โ€‹

Defined in: core/values/block-state.ts:40

A resource pack blockstate: which models render each state of an existing block. Registered with Datapack.blockState.

dp.blockState("note_block", BlockState.variants({ "note=0": { model: myModel }, // repurpose an unused note pitch }));

Constructors โ€‹

Constructor โ€‹

new BlockState(): BlockState

Returns โ€‹

BlockState

Methods โ€‹

part() โ€‹

part(part): this

Defined in: core/values/block-state.ts:59

Add a multipart case verbatim ({ when?, apply }) - the flexible builder.

Parameters โ€‹

part โ€‹

unknown

Returns โ€‹

this


raw() โ€‹

raw(json): this

Defined in: core/values/block-state.ts:65

Verbatim blockstate JSON escape hatch; wins over the typed fields.

Parameters โ€‹

json โ€‹

Record<string, unknown>

Returns โ€‹

this


toJson() โ€‹

toJson(): Record<string, unknown>

Defined in: core/values/block-state.ts:71

The blockstate-file JSON.

Returns โ€‹

Record<string, unknown>


variant() โ€‹

variant(state, v): this

Defined in: core/values/block-state.ts:53

Map a single blockstate string to a variant (repeatable).

Parameters โ€‹

state โ€‹

string

v โ€‹

VariantValue

Returns โ€‹

this


variants() โ€‹

static variants(map): BlockState

Defined in: core/values/block-state.ts:46

A variants-style file mapping state strings ("", facing=north) to models.

Parameters โ€‹

map โ€‹

Record<string, VariantValue>

Returns โ€‹

BlockState

Released under the MIT License ยท Credits
These docs were written with AI; the layout and every page have been reviewed by a human.