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

helix / BlockValue

Class: BlockValue<Id> โ€‹

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

A value that is input only; the IR (ir/lower/) renders it for each version.

Extends โ€‹

Type Parameters โ€‹

Id โ€‹

Id extends string = string

Constructors โ€‹

Constructor โ€‹

new BlockValue<Id>(id, states?): BlockValue<Id>

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

Parameters โ€‹

id โ€‹

Id

states? โ€‹

StatesOf<Id>

Returns โ€‹

BlockValue<Id>

Overrides โ€‹

LoweredValue.constructor

Properties โ€‹

id โ€‹

readonly id: Id

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


lowered โ€‹

protected readonly lowered: true = true

Defined in: core/values/value.ts:14

Tells lowered values apart from plain objects (e.g. NBT compounds).

Inherited from โ€‹

LoweredValue.lowered


nbt? โ€‹

optional nbt?: string | NbtValue

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

Block-entity data: raw SNBT or an Nbt value.


states โ€‹

readonly states: BlockStates = {}

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

Methods โ€‹

baseId() โ€‹

baseId(): string

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

The namespaced id or tag, without state or data.

Returns โ€‹

string


data() โ€‹

data(nbt): this

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

Block-entity NBT. A block with a typed factory (Chest, DecoratedPot, ... - see block-entities.generated.ts) only accepts that factory's output; a bare Nbt(...) or raw SNBT string is a compile error there, so fix it at the call site. A dynamic/unknown block id keeps the permissive string | Nbt form, with a runtime warning instead (the type can't see which block it is).

Parameters โ€‹

nbt โ€‹

Id extends keyof BlockEntityDataByBlockId ? BlockEntityDataByBlockId[Id] : string | NbtValue

Returns โ€‹

this


state() โ€‹

state(props): this

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

Sets state properties, e.g. Block.OAK_DOOR.state({ half: "upper", open: true }).

Parameters โ€‹

props โ€‹

StatesOf<Id>

Returns โ€‹

this

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